Link to home
Start Free TrialLog in
Avatar of Jason Yu
Jason YuFlag for United States of America

asked on

what does this command mean "sudo su - -s /bin/bash jenkins"

I couldn't understand what this command does "sudo su - -s /bin/bash jenkins". Is it log in as jenkins user under the current shell?



root@monitor:/home/jyu$ su - jenkins
su: user - does not exist
root@monitor:/home/jyu$ cat /etc/passwd | grep jenkins
root@monitor:/home/jyu$ sudo su - -s /bin/bash jenkins
Last login: Fri Jul 15 17:17:09 UTC 2016 on pts/1
[jenkins@monitor ~]$ whoami
jenkins
[jenkins@monitor ~]$ ls -alth
total 56K
-rw------- 1 jenkins jenkins 8.5K Jul 15 17:44 .bash_history
drwx------ 2 jenkins jenkins 4.0K Jul 15 16:55 .ssh
drwxr-xr-x 4 jenkins jenkins 4.0K Jul 15 16:55 .
-rw------- 1 jenkins jenkins  11K Jul 15 16:55 .viminfo
drwxr-xr-x 8 root    root    4.0K May 27 22:26 ..
drwxr-xr-x 3 jenkins jenkins 4.0K Jul  8  2014 .java
-rw-r--r-- 1 jenkins jenkins   18 Jul  3  2014 .bash_logout
-rw-r--r-- 1 jenkins jenkins  124 Jul  3  2014 .bashrc
-rw-r--r-- 1 jenkins jenkins  171 Jul  3  2014 .kshrc
-rw-r--r-- 1 jenkins jenkins  176 Jul  3  2014 .bash_profile
[jenkins@monitor ~]$
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason Yu

ASKER

Yes, you are right. In my environment, su is an alias of "su -".

root@monitor:/home/jyu$ alias su
alias su='su -'
root@monitor:/home/jyu$
That's why "su - jenkins" throws an error.