- Linux
- OpenBSD
- FreeBSD
- Solaris
- bash/shell
- » ab
- » arp
- » arping
- » awk
- » bzip2, bunzip2, bzip2re...
- » chcase
- » chkconfig
- » chmod
- » chown
- » comm
- » convert
- » cat
- » cp
- » cpio
- » cryptsetup
- » curl
- » date
- » diff
- » dig
- » dumpe2fs
- » e2fsck(fsck.{ext2,ext3})
- » eval
- » exportfs
- » file
- » find
- » ftp
- » fuser
- » getfacl
- » grep, egrep, fgrep
- » grub
- » gzip, gunzip
- » hdparm
- » head
- » host
- » ifconfig
- » ifenslave
- » import
- » ionice
- » ip
- » ipcs, ipcrm
- » kill
- » ldconfig
- » ld
- » ldd
- » less
- » locale
- » locate
- » losetup
- » ls
- » lsmod
- » lsof
- » man
- » mke2fs(mkfs.{ext2,ext3})
- » mkinitrd
- » mknod
- » mkswap
- » modinfo
- » modprobe
- » mount
- » mtr
- » mv
- » mysql
- » mysqladmin
- » mysqldump
- » netstat
- » netstat-nat
- » nice
- » nc
- » nm
- » nslookup
- » objdump
- » openssl
- » parted
- » patch
- » perl
- » pg_dump
- » pidof
- » ping
- » pkg-config
- » ps
- » psql
- » rar
- » readelf
- » renice
- » rm
- » rmmod
- » route
- » rpcinfo
- » rpm
- » rsync
- » screen
- » sed
- » sendmail
- » seq
- » setfacl
- » sfdisk
- » showmount
- » shred
- » smartctl
- » smbclient
- » smbget
- » smbpasswd
- » socat
- » sort
- » sox
- » split
- » ssh
- » ssh-keygen
- » stat
- » stdbuf
- » strace
- » svn, svnadmin
- » systool
- » tail
- » tar
- » tcpdump
- » top
- » tr
- » tracepath
- » traceroute
- » tune2fs
- » udevcontrol, udevadm
- » unclutter
- » uniq
- » unzip
- » uuencode, uudecode
- » vim
- » vncviewer
- » vnstat
- » wc
- » wget
- » wput
- » xargs
- » xhost
- » xprop
- » xrandr
- » xwd
- » xxd
- » yum
- » zip, zip{cloak,note,split}
- KDE
- GTK
CONTENT
- CHANGES
Szukaj
#top sudo¶
sudo, sudoedit - execute a command as another user
Powiązane:
su, sudo,
SYNOPSIS
sudo -h │ -K │ -k │ -L │ -l │ -V │ -v
sudo [-bEHPS] [-p prompt] [-u username│#uid] [VAR=value] {-i │ -s │ command}
sudoedit [-S] [-p prompt] [-u username│#uid] file ...
sudo [-bEHPS] [-p prompt] [-u username│#uid] [VAR=value] {-i │ -s │ command}
sudoedit [-S] [-p prompt] [-u username│#uid] file ...
DESCRIPTION
OPTIONS
-b
-E
-e
-H
-h
-i
-K
-k
-L
-l
-P
-p
-S
-s
-u
-V
-v
--
The -b (background) option tells sudo to run the given command in
the background. Note that if you use the -b option you cannot use
shell job control to manipulate the process.
the background. Note that if you use the -b option you cannot use
shell job control to manipulate the process.
-E
The -E (preserve environment) option will override the env_reset
option in sudoers(5)). It is only available when either the
matching command has the SETENV tag or the setenv option is set in
sudoers(5).
option in sudoers(5)). It is only available when either the
matching command has the SETENV tag or the setenv option is set in
sudoers(5).
-e
The -e (edit) option indicates that, instead of running a command,
the user wishes to edit one or more files. In lieu of a command,
the string "sudoedit" is used when consulting the sudoers file. If
the user is authorized by sudoers the following steps are taken:
1. Temporary copies are made of the files to be edited with the
owner set to the invoking user.
2. The editor specified by the VISUAL or EDITOR environment vari-
ables is run to edit the temporary files. If neither VISUAL
nor EDITOR are set, the program listed in the editor sudoers
variable is used.
3. If they have been modified, the temporary files are copied back
to their original location and the temporary versions are
removed.
If the specified file does not exist, it will be created. Note
that unlike most commands run by sudo, the editor is run with the
invoking user's environment unmodified. If, for some reason, sudo
is unable to update a file with its edited version, the user will
receive a warning and the edited copy will remain in a temporary
file.
the user wishes to edit one or more files. In lieu of a command,
the string "sudoedit" is used when consulting the sudoers file. If
the user is authorized by sudoers the following steps are taken:
1. Temporary copies are made of the files to be edited with the
owner set to the invoking user.
2. The editor specified by the VISUAL or EDITOR environment vari-
ables is run to edit the temporary files. If neither VISUAL
nor EDITOR are set, the program listed in the editor sudoers
variable is used.
3. If they have been modified, the temporary files are copied back
to their original location and the temporary versions are
removed.
If the specified file does not exist, it will be created. Note
that unlike most commands run by sudo, the editor is run with the
invoking user's environment unmodified. If, for some reason, sudo
is unable to update a file with its edited version, the user will
receive a warning and the edited copy will remain in a temporary
file.
-H
The -H (HOME) option sets the HOME environment variable to the
homedir of the target user (root by default) as specified in
passwd(5). By default, sudo does not modify HOME (see set_home and
always_set_home in sudoers(5)).
homedir of the target user (root by default) as specified in
passwd(5). By default, sudo does not modify HOME (see set_home and
always_set_home in sudoers(5)).
-h
The -h (help) option causes sudo to print a usage message and exit.
-i
The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a '-' to
tell the shell to run as a login shell. sudo attempts to change to
that user's home directory before running the shell. It also ini-
tializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a '-' to
tell the shell to run as a login shell. sudo attempts to change to
that user's home directory before running the shell. It also ini-
tializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.
-K
The -K (sure kill) option is like -k except that it removes the
user's timestamp entirely. Like -k, this option does not require a
password.
user's timestamp entirely. Like -k, this option does not require a
password.
-k
The -k (kill) option to sudo invalidates the user's timestamp by
setting the time on it to the Epoch. The next time sudo is run a
password will be required. This option does not require a password
and was added to allow a user to revoke sudo permissions from a
.logout file.
setting the time on it to the Epoch. The next time sudo is run a
password will be required. This option does not require a password
and was added to allow a user to revoke sudo permissions from a
.logout file.
-L
The -L (list defaults) option will list out the parameters that may
be set in a Defaults line along with a short description for each.
This option is useful in conjunction with grep(1).
be set in a Defaults line along with a short description for each.
This option is useful in conjunction with grep(1).
-l
The -l (list) option will list out the allowed (and forbidden) com-
mands for the invoking user on the current host.
mands for the invoking user on the current host.
-P
The -P (preserve group vector) option causes sudo to preserve the
invoking user's group vector unaltered. By default, sudo will ini-
tialize the group vector to the list of groups the target user is
in. The real and effective group IDs, however, are still set to
match the target user.
invoking user's group vector unaltered. By default, sudo will ini-
tialize the group vector to the list of groups the target user is
in. The real and effective group IDs, however, are still set to
match the target user.
-p
The -p (prompt) option allows you to override the default password
prompt and use a custom one. The following percent ('%') escapes
are supported:
%H expanded to the local hostname including the domain name (on if
the machine's hostname is fully qualified or the fqdn sudoers
option is set)
%h expanded to the local hostname without the domain name
%p expanded to the user whose password is being asked for
(respects the rootpw, targetpw and runaspw flags in sudoers)
%U expanded to the login name of the user the command will be run
as (defaults to root)
%u expanded to the invoking user's login name
%% two consecutive % characters are collapsed into a single %
character
prompt and use a custom one. The following percent ('%') escapes
are supported:
%H expanded to the local hostname including the domain name (on if
the machine's hostname is fully qualified or the fqdn sudoers
option is set)
%h expanded to the local hostname without the domain name
%p expanded to the user whose password is being asked for
(respects the rootpw, targetpw and runaspw flags in sudoers)
%U expanded to the login name of the user the command will be run
as (defaults to root)
%u expanded to the invoking user's login name
%% two consecutive % characters are collapsed into a single %
character
-S
The -S (stdin) option causes sudo to read the password from the
standard input instead of the terminal device.
standard input instead of the terminal device.
-s
The -s (shell) option runs the shell specified by the SHELL envi-
ronment variable if it is set or the shell as specified in
passwd(5).
ronment variable if it is set or the shell as specified in
passwd(5).
-u
The -u (user) option causes sudo to run the specified command as a
user other than root. To specify a uid instead of a username, use
#uid. When running commands as a uid, many shells require that the
'#' be escaped with a backslash ('\'). Note that if the targetpw
Defaults option is set (see sudoers(5)) it is not possible to run
commands with a uid not listed in the password database.
user other than root. To specify a uid instead of a username, use
#uid. When running commands as a uid, many shells require that the
'#' be escaped with a backslash ('\'). Note that if the targetpw
Defaults option is set (see sudoers(5)) it is not possible to run
commands with a uid not listed in the password database.
-V
The -V (version) option causes sudo to print the version number and
exit. If the invoking user is already root the -V option will
print out a list of the defaults sudo was compiled with as well as
the machine's local network addresses.
exit. If the invoking user is already root the -V option will
print out a list of the defaults sudo was compiled with as well as
the machine's local network addresses.
-v
If given the -v (validate) option, sudo will update the user's
timestamp, prompting for the user's password if necessary. This
extends the sudo timeout for another 5 minutes (or whatever the
timeout is set to in sudoers) but does not run a command.
timestamp, prompting for the user's password if necessary. This
extends the sudo timeout for another 5 minutes (or whatever the
timeout is set to in sudoers) but does not run a command.
--
The -- flag indicates that sudo should stop processing command line
arguments. It is most useful in conjunction with the -s flag.
Environment variables to be set for the command may also be passed on
the command line in the form of VAR=value, e.g.
LD_LIBRARY_PATH=/usr/local/pkg/lib. Variables passed on the command
line are subject to the same restrictions as normal environment vari-
ables with one important exception. If the setenv option is set in
sudoers, the command to be run has the SETENV tag set or the command
matched is ALL, the user may set variables that would overwise be for-
bidden. See sudoers(5) for more information.
arguments. It is most useful in conjunction with the -s flag.
Environment variables to be set for the command may also be passed on
the command line in the form of VAR=value, e.g.
LD_LIBRARY_PATH=/usr/local/pkg/lib. Variables passed on the command
line are subject to the same restrictions as normal environment vari-
ables with one important exception. If the setenv option is set in
sudoers, the command to be run has the SETENV tag set or the command
matched is ALL, the user may set variables that would overwise be for-
bidden. See sudoers(5) for more information.
Zmodyfikowany ostatnio: 2015/06/08 10:20:04 (10 lat temu),
textsize: 7,95 kB,
htmlsize: 9,16 kB
Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników