跳转至

su 命令


2015-10-28 by dongnan

举个栗子

postgres 用户身份创建目录

/bin/su - postgres -c 'mkdir -p /home/backup/20150901'

命令帮助

NAME
       su - run a shell with substitute user and group IDs

SYNOPSIS
       su [OPTION]... [-] [USER [ARG]...]

DESCRIPTION
       Change the effective user id and group id to that of USER.

       -, -l, --login
              make the shell a login shell, clears all envvars except for TERM, 
              initializes HOME, SHELL, USER, LOGNAME and PATH

       -c, --command=command
              Pass command to the shell with the -c option.




回到页面顶部