English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Linux su (vollständiger englischer Name: switch user) Befehl wird verwendet, um den Benutzeraccount zu ändern, außer root, ist das Passwort des Benutzers erforderlich.
Berechtigungen: Alle Benutzer.
su [-fmp] [-c command] [-s shell] [--help] [--version] [-] [USER [ARG]]
Parameterbeschreibung:
Change account to root and exit after executing ls command to return to the original user
su -c ls root
Change account to root and pass -f parameter for the new executed shell
su root -f
Change account to clsung and change working directory to clsung's home directory (home dir)
su - clsung
Switch User
[email protected]:~$ whoami //Show Current User hnlinux [email protected]:~$ pwd //Show Current Directory /home/hnlinux [email protected]:~$ su root //Switch to root User Password: [email protected]:/home/hnlinux# whoami root [email protected]:/home/hnlinux# pwd /home/hnlinux
Switch User, Change Environment Variables
[email protected]:~$ whoami //Show Current User hnlinux [email protected]:~$ pwd //Show Current Directory /home/hnlinux [email protected]:~$ su - root //Switch to root User Password: [email protected]:/home/hnlinux# whoami root [email protected]:/home/hnlinux# pwd //Show Current Directory /root