Solved

How to modify PATH variable for the root user on Solaris 10?

Posted on 2010-09-09
22
1,244 Views
Last Modified: 2013-12-21
I have installed VNC from the companion CD and when I try to run the following command:
# ./vncserver -Kill :2
vncserver: couldn't find "xauth" on your PATH.

It gives me the xauth error message above. I have located the "xauth" program which is located in:
/usr/openwin/bin

So now I need to know how to permanently add this directory to the roots existing PATH variable?
0
Comment
Question by:Turbowy
  • 10
  • 8
  • 3
  • +1
22 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33642422
what shell are you using to login, is it bourne shell?
depending on the shell you would have a profile
eg for bourne shell its .profile

You can update your path like this

PATH=$PATH:/usr/openwin/bin
export PATH

you can look in /etc/passwd to find out your shell or do  "ps"   to find out

profile filenames vary based on the shell
0
 

Author Comment

by:Turbowy
ID: 33642469
Hi rockiroads:

# ps
   PID TTY         TIME CMD
  3962 syscon      0:00 tcsh
  3991 syscon      0:00 ps
  3961 syscon      0:00 sh

# PATH=$PATH:/usr/openwinbinbin
Bad : modifier in $ (/).

any other ideas?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33642513
you got two shells tcsh and sh, I thought sh might be the first shell due to pid, but you are running tcsh

can you go to your home directory and do

ls -a

(home directory is just   cd)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33642516
what files beginning with . are displayed
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33642521
seems tcsh is based from ksh so try this

setenv PATH $PATH:/usr/openwin/bin

or

set path = ($path /usr/openwin/bin)
0
 

Author Comment

by:Turbowy
ID: 33642679
drwxr-xr-x  27 root     root        1024 Sep  9 15:24 .
drwxr-xr-x  27 root     root        1024 Sep  9 15:24 ..
-rw-------   1 root     root          74 Sep  6 21:54 .TTauthority
-rw-------   1 root     root         102 Sep  6 21:54 .Xauthority
drwxr-xr-x  11 root     root         512 Sep  8 19:53 .dt
-rwxr-xr-x   1 root     root        5111 Sep  2 22:41 .dtprofile
drwx------   3 root     root         512 Sep  1 07:56 .sunw
drwxr-xr-x   2 root     root         512 Sep  9 15:25 .vnc
drwxr-xr-x   2 root     root         512 Sep  2 22:41 TT_DB
lrwxrwxrwx   1 root     root           9 Sep  1 00:20 bin -> ./usr/bin
drwxr-xr-x   1 root     root       16384 Dec 31  1969 boot
drwxr-xr-x   4 root     root         512 Sep  9 15:30 cdrom
drwxr-xr-x  17 root     sys         4096 Sep  9 15:30 dev
drwxr-xr-x   2 root     sys          512 Sep  8 19:54 devices
drwxr-xr-x  76 root     sys         4608 Sep  9 15:30 etc
drwxr-xr-x   3 root     sys          512 Sep  1 00:20 export
dr-xr-xr-x   1 root     root           1 Sep  9 15:30 home
drwxr-xr-x  16 root     sys          512 Sep  1 23:30 kernel
drwxr-xr-x   6 root     bin         5120 Sep  2 22:27 lib
drwx------   2 root     root        8192 Sep  1 00:20 lost+found
drwxr-xr-x   3 root     sys          512 Sep  9 10:19 mnt
dr-xr-xr-x   1 root     root           1 Sep  9 15:30 net
-rw-r--r--   1 root     root           0 Sep  1 00:27 noautoshutdown
drwxr-xr-x   6 root     sys          512 Sep  9 13:49 opt
drwxr-xr-x   4 root     sys          512 Sep  1 00:22 platform
dr-xr-xr-x  57 root     root      126656 Sep  9 20:02 proc
drwxr-xr-x   2 root     sys         1024 Sep  1 23:28 sbin
drwxr-xr-x   4 root     root         512 Sep  1 00:20 system
drwxrwxrwt   5 root     sys          365 Sep  9 17:45 tmp
drwxr-xr-x  39 root     sys         1024 Sep  2 22:31 usr
drwxr-xr-x  42 root     sys         1024 Sep  2 22:40 var
dr-xr-xr-x   6 root     root         512 Sep  9 15:30 vol

The following worked, now how can I do this on permenent basis?
set path = ($path /usr/openwin/bin)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33642851
only profile file appears to be

-rwxr-xr-x   1 root     root        5111 Sep  2 22:41 .dtprofile


so in your home directory, edit .dtprofile and add in the lines

see my last post on 2 ways of setting PATH (setenv or set) try them, see which one works then add to .dtprofile.
check what the first line is in .dtprofile, it may begin with #/usr/...  some shell
0
 

Author Comment

by:Turbowy
ID: 33643152
Do you know exactly where I should add this line in the .dtprofile ?

#############################################################################
###
###   .dtprofile
###
###   user personal environment variables
###
###   Common Desktop Environment (CDE)
###
###   (c) Copyright 1993-1997 Sun Microsystems, Inc.
###   (c) Copyright 1993,1994 Hewlett-Packard Company
###   (c) Copyright 1993,1994 International Business Machines Corp.
###   (c) Copyright 1993,1994 Novell, Inc.
###
###
###   @(#)dtprofile.src 1.10 97/05/20
###
#############################################################################


#############################################################################
###
###   Your $HOME/.dtprofile is read each time you login to the Common Desktop
###   Environment (CDE) and is the place to set or override desktop
###   environment variables for your session. Environment variables set in
###   $HOME/.dtprofile are made available to all applications on the desktop.
###   The desktop will accept either sh or ksh syntax for the commands in
###   $HOME/.dtprofile.
###
#############################################################################


#############################################################################
###
###   Random stdout and stderr output from the desktop Session Mgr can be
###   directed into user's $HOME/.dt/sessionlogs directory.  By default this
###   output is not recorded.  Instead it is sent off to /dev/null (Unix's
###   "nothing" device).
###
###   If this random dtsession output is wanted (usually only wanted for
###   debugging purposes), commenting out following "dtstart_sessionlogfile"
###   lines will send output to your $HOME/.dt/sessionlogs directory.
###
###   Alternatively, can change "/dev/null" to "/dev/console" to see this
###   debugging output on your console device.  Can start a console via the
###   Workspace programs menu or via Application Mgr's Desktop Tools
###   "Terminal Console" icon.
###
#############################################################################

echo "This session log file is currently disabled."    > $dtstart_sessionlogfile
echo "To enable logging, edit $HOME/.dtprofile and" >> $dtstart_sessionlogfile
echo "remove dtstart_sessionlogfile=/dev/null line."  >> $dtstart_sessionlogfile
export dtstart_sessionlogfile="/dev/null"


#############################################################################
###
###   By default, the desktop will read your standard $HOME/.profile
###   or $HOME/.login files. This can be changed commenting out the
###   DTSOURCEPROFILE variable assignment at the end of this file. The
###   desktop reads .profile if your $SHELL is "sh" or "ksh", or .login
###   if your $SHELL is "csh".
###
###   The desktop reads the .dtprofile and .profile/.login with a simulated
###   terminal via the sdt_shell program.  The sdt_shell program will create
###   a controlling terminal.  Shell output will be logged to the location
###   $HOME/.dt/startlog.  Any shell requested input will receive an end
###   of file character (Control-D).
###
###   This being the case .profile/.login should avoid requiring interaction
###   with the user at login time. Any messages printed in these scripts will
###   not be seen when you log in and any prompts such as by the "read"
###   command will return an end-of-file to the calling script.
###
###   With minor editing, it is possible to adapt your .profile or .login
###   for use both with and without the desktop.  Group user interaction
###   statements not appropriate for your desktop session into one section
###   and enclose them with an "if" statement that checks for absence of
###   of the "DT" environment variable. When the desktop reads your .profile
###   or .login file, it will set "DT" to a non-empty value for which your
###   .profile or .login can test.
###
###   example for sh/ksh
###
###     if [ ! "$DT" ]; then
###       #
###       # commands and environment variables not appropriate for desktop
###       #
###        echo "Please enter some data:"
###       read data
###        ...
###     fi
###
###     #
###     # environment variables common to both desktop and non-desktop
###     #
PATH=$PATH:/usr/openwin/bin



###     PATH=$HOME/bin:$PATH
###     MYVAR=value
###     export MYVAR
###     ...
###
###
###   example for csh
###
###     if ( ! ${?DT} ) then
###       #
###       # commands and environment variables not appropriate for desktop
###       #
###        echo "Please enter some data:"
###       read data
###       ...
###     endif
###
###     #
###     # environment variables common to both desktop and non-desktop
###     #
###     setenv PATH $HOME/bin:$PATH
###     setenv MYVAR value
###     ...
###
###   Errors in .dtprofile/.profile/.login are logged to "$HOME/.dt/startlog".
###   If after you login, an environment they should have set and exported is
###   not present and this $HOME/.dtprofile file has set "DTSOURCEPROFILE=true"
###   check $HOME/.dt/startlog for possible .profile/.login script error
###   output.
###
##############################################################################

DTSOURCEPROFILE=true
0
 
LVL 9

Expert Comment

by:amolg
ID: 33643318
place it in /etc/profile.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33643420
where you have it is fine though probably better towards the end

remember to put

export PATH afterwards



DTSOURCEPROFILE=true

PATH=$PATH:/usr/openwin/bin
export PATH
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33643421
you need to logout then login again to see the changes
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 48

Expert Comment

by:Tintin
ID: 33643634
Note that your login shell is /bin/sh, but either in your profile or manually, you are running tcsh.

Which shell do you prefer running?
0
 

Author Comment

by:Turbowy
ID: 33646385
Hi rockiroads:

I did as you suggested, I logged out and logged in, I still get the following results:

# env
HOME=/
HZ=
LANG=C
LOGNAME=root
MAIL=/var/mail/root
PATH=/usr/sbin:/usr/bin
SHELL=/sbin/sh
TERM=xterm
TZ=Canada/Eastern

any other suggestions?
0
 

Author Comment

by:Turbowy
ID: 33646477
amolg: that seem to have done the trick, I did as you suggested and it is applied when i log in as root, the only disadvantage is that  all the users will get this PATH now, but what if i want to only apply this to root?

tintin: I was using tcsh only for autolist, as in Solaris 10 for some reason the bs does not want to autolist your previous commands, for now I got rid of the tcsh and using /sbin/sh now

rickiroads: can you think of anything else, you have done a great work so far!
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33646658
wonder what profile it is using, I thought it was bourne shell cos I saw sh in your process

try adding it to .profile (might be new file)

PATH=$PATH:/usr/openwin/bin
export PATH


the line export is important
0
 

Author Comment

by:Turbowy
ID: 33649672
rockiroads:
if I cd
i dont see .profile
should I create a .profile file?
I got rid off the tcsh, so now it is using bourne shell
0
 
LVL 9

Expert Comment

by:amolg
ID: 33649809
check ls -a
.profile shuld be there...include in that to apply only for root...
0
 
LVL 9

Expert Comment

by:amolg
ID: 33649819
As root, do "cd ~"
and then ls -a, you should see .profile.

0
 

Author Comment

by:Turbowy
ID: 33649941
when I do, I get

# cd ~
~: does not exist

i also tried this:

# cd
# pwd
/
# ls -a
.               TT_DB           home            platform
..              bin             kernel          proc
.TTauthority    boot            lib             sbin
.Xauthority     cdrom           lost+found      system
.dt             dev             mnt             tmp
.dtprofile      devices         net             usr
.sunw           etc             noautoshutdown  var
.vnc            export          opt             vol
#
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 33650194
just create it yes it should be fine. it is not there so it would have to be created
0
 

Author Closing Comment

by:Turbowy
ID: 33650281
Thank you very much for all the great help, it works like a charm!
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33650993
cool.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now