最終更新:2016-12-05 (月) 16:24:11 (2691d)  

su
Top / su

super user, or switch user

run a shell with substitute user and group IDs

http://www.atmarkit.co.jp/fsecurity/rensai/unix_sec04/unix_sec01.html

su -?

su -
  • - ハイフンは、ユーザーの切り替えと同時に環境の切り替えを行うことを表します。ハイフンを付けなかった場合は切り替え前のユーザーの環境を引き継ぎ、ユーザーのみを切り替えます。
  • 例えば、一般ユーザーからrootユーザーへ切り替えた場合、ハイフン付きで切り替えるとshutdownなどrootユーザーにしか使えないコマンドが利用可能ですが、ハイフンを付けなかった場合、rootユーザーに切り替えてもこれらのコマンドは使えません
  • sudo su -
  • The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly.

su -c

man

  •        Change the effective user id and group id to that of USER.
    
           -, -l, --login
                  make the shell a login shell
    
           -c, --command=COMMAND
                  pass a single COMMAND to the shell with -c
    
           --session-command=COMMAND
                  pass a single COMMAND to the shell with -c and do not create a new session
    
           -f, --fast
                  pass -f to the shell (for csh or tcsh)
    
           -m, --preserve-environment
                  do not reset environment variables
    
           -p     same as -m
    
           -s, --shell=SHELL
                  run SHELL if /etc/shells allows it
    
           --help display this help and exit
    
           --version
                  output version information and exit
    
           A mere - implies -l.   If USER not given, assume root.
    

Android/root化

関連