26 Ağustos 2019 Pazartesi

su komutu

Giriş
Açıklaması şöyle.
The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.
-l seçeneği
Yeni bir login shell başlatır. Açıklaması şöyle
If you only give a username as argument, su changes user without changing much else:

So su postgres stays in the same directory. However since HOME is set to the new 
user’s home directory, cd will take you to the right place.

To log in and start from the user’s default directory, you need to ask su to start 
a login shell set up appropriately:

su -l postgres
or its common synonym,

su - postgres
Örnek
Şöyle yaparız
13:27:20 /home/jim> su -l mike
Password:(I type mike's password (or have him type it) and press Enter)
13:27:22 /home/mike> id
uid=1004(mike) gid=1004(mike) groups=1004(mike)
13:27:25 /home/mike> exit  # this leaves mike's login shell and returns to jim's
13:27:29 /home/jim> id
uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),...

Hiç yorum yok:

Yorum Gönder