A portable solution would be:
su abc -c google-chrome
However, as google-chrome is requiring X11 access, this will likely fail unless you unsecured it, which would be a very bad idea, especially while running as root.
If X11 tunelling/forwarding is allowed, a better way would be
ssh -X abc@localhost google-chrome
or
ssh -Y abc@localhost google-chrome
Short answer:
You command was incorrect:
useradd -d /path/to/home -s /path/to/shell -g admin username
Use
useradd -d /home/username -s /bin/sh -g admin username
to create normal user.
Tady posted some info in the chat:
tady:$:15750:0:99999:7:::
squarepeg:$:15751:0:99999:7:::
that's the /etc/shadow
and the /etc/passwd
tady:x:5001:5001::/var/www:/bin/false
squarepeg:x:5003:109:square peg design:/var/www:/bin/false
The /bin/false home directory exists, I created it so users had somewhere to go even
though they never use it (though looking at it, it's owner and group are root:root.
would this matter?)
The /var/www shell is where I want them to go when they login
"The format of the passwd file is pretty standard."
Yes, it is true. And format is informally described here: Wikipedia:Passwd (file); or, more normative, man 5 passwd
(from ubuntu)
Check an example:
jsmith:.......:/home/jsmith:/bin/sh
Wiki decodes it as:
The sixth field is the path to the user's home directory.
The seventh field is the program that is started every time the user logs into the system. ... this is usually one of the system's command line interpreters (shells).
So, jmsith has home directory /home/jsmith
and shell program /bin/sh
which is legal shell (all legal shells are listed in the file /etc/shells
). Check man shells
, it says:
/etc/shells is a text file which contains the full pathnames of valid login shells...
Be aware that there are programs which consult this file to find out if a user is a normal user. E.g.: ftp daemons traditionally disallow access to users with shells not included in this file.
In my Linux /bin/false
is not listed here as valid shell.
According to citation of your passwd, tady and squarepeg have the home dir /var/www
and /bin/false
is their shell program. When they login in, shell is started; after shell termination, session is closed. /bin/false
is simple unix program which ... exits in short time (check Wikipedia:False (Unix) or just think about it as main(){return 1;}
).
Normal shell is the interactive program which reads user input and executes it in endless loop. Shell is started when you does ssh
to the computer. And you can't use ftp for users who has /bin/false
shell.
PS: If you want to prohibit somebody of using ssh, but allow them to use vsftpd, there are hacks
Best Answer
Yo will have to allow the new user to access your X server.
must be issued before
su name_of_2nd_user
.