Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1318
  • Last Modified:

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

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
Turbowy
Asked:
Turbowy
  • 10
  • 8
  • 3
  • +1
1 Solution
 
rockiroadsCommented:
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
 
TurbowyAuthor Commented:
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
 
rockiroadsCommented:
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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
rockiroadsCommented:
what files beginning with . are displayed
0
 
rockiroadsCommented:
seems tcsh is based from ksh so try this

setenv PATH $PATH:/usr/openwin/bin

or

set path = ($path /usr/openwin/bin)
0
 
TurbowyAuthor Commented:
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
 
rockiroadsCommented:
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
 
TurbowyAuthor Commented:
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
 
AmolCommented:
place it in /etc/profile.
0
 
rockiroadsCommented:
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
 
rockiroadsCommented:
you need to logout then login again to see the changes
0
 
TintinCommented:
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
 
TurbowyAuthor Commented:
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
 
TurbowyAuthor Commented:
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
 
rockiroadsCommented:
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
 
TurbowyAuthor Commented:
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
 
AmolCommented:
check ls -a
.profile shuld be there...include in that to apply only for root...
0
 
AmolCommented:
As root, do "cd ~"
and then ls -a, you should see .profile.

0
 
TurbowyAuthor Commented:
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
 
rockiroadsCommented:
just create it yes it should be fine. it is not there so it would have to be created
0
 
TurbowyAuthor Commented:
Thank you very much for all the great help, it works like a charm!
0
 
rockiroadsCommented:
cool.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 8
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now