"su" and user shell arguments

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
(New page: The "su" command does not seem to work when the user's shell has a space (e.g., for command arguments). $ '''cat /etc/redhat-release''' Red Hat Enterprise Linux WS release 3 (Taroon Upd...)
Current revision (16:45, 11 November 2008) (edit) (undo)
 
Line 21: Line 21:
hutchib:x:6919:0:Brandon Hutchinson - MSP UNIX:/home/hutchib:/home/vt3k$
hutchib:x:6919:0:Brandon Hutchinson - MSP UNIX:/home/hutchib:/home/vt3k$
-
#'''su - hutchib'''
+
# '''su - hutchib'''
freevt3k - version A.01.03 (Oct 20 2000-13:43:13)
freevt3k - version A.01.03 (Oct 20 2000-13:43:13)

Current revision

The "su" command does not seem to work when the user's shell has a space (e.g., for command arguments).

$ cat /etc/redhat-release
Red Hat Enterprise Linux WS release 3 (Taroon Update 4)
$ grep hutchib /etc/passwd
hutchib:x:6919:0:Brandon Hutchinson - MSP UNIX:/home/hutchib:/home/vt3k 10.0.0.1
# su - hutchib
su: /home/vt3k 10.0.0.1: No such file or directory

After doing some testing, it turns out that a space in the user's shell causes problems.

$ grep hutchib /etc/passwd | cat -vet
hutchib:x:6919:0:Brandon Hutchinson - MSP UNIX:/home/hutchib:/home/vt3k $
# su - hutchib
su: /home/vt3k : No such file or directory
$ grep hutchib /etc/passwd | cat -vet
hutchib:x:6919:0:Brandon Hutchinson - MSP UNIX:/home/hutchib:/home/vt3k$
# su - hutchib
freevt3k - version A.01.03 (Oct 20 2000-13:43:13)

Usage: freevt3k [-li|-lo|-lio] [-f file] [-x] [-tt n] [-t]
                [-C breakchar] [-B count] [-T timer]
                [-X file] [-a|-I file] [-d[d]] host 
...

I don't know of a direct workaround for this using su. You could place /home/vt3k 10.0.0.1 in the user's profile and use a "real shell," but I imagine there is a slight possibility the user could escape into the real shell.

telnet/ssh works as expected when the user's shell (in this case, /home/vtk3) contains arguments.

Personal tools