Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

sudo

From Simple English Wikipedia, the free encyclopedia
For the Japanese surname, seeSudo (surname).
The sudo command in theUbuntu distribution ofLinux

Thesudo command is a program forUnix-like operating systems likeLinux distributions. It allowsusers to runprograms as another user. The "su" portion is sometimes described assubstitute user, super user, or switch user.

Importance

[change |change source]

The sudo command gives theadministrator the option of allowing certain users access to otherwise disallowedcommands on agranular level. This power must be carefully administered as it could potentially allow users to make changes tofiles that could cause serious damage to other users' files as well as damaging theoperating system itself.

Usage

[change |change source]

The sudo command is used from thecommand line.

For example: Imagine a system has three users: student, JOE, and BOB.

[JOE@clone7 ~]$ /bin/grep "home" /etc/passwd student:x:1000:1000:Student:/home/student:/bin/bashBOB:x:1001:1001::/home/BOB:/bin/bashJOE:x:1002:1002::/home/JOE:/bin/bash[JOE@clone7 ~]$

JOE wants to know what files are in BOB's home directory. As one would expect, unless given rights through other means, JOE will be denied:

[JOE@clone7 ~]$ ls -lrt /home/BOBls: cannot open directory /home/BOB: Permission denied[JOE@clone7 ~]$

If JOE is in the sudoer file, he can use the sudo command to run the ls command as if he were BOB:

[JOE@clone7 ~]$ sudo -u BOB  ls -lrt /home/BOB[sudo] password for JOE: total 0-rw-r--r--. 1 BOB BOB 0 Jan  6 06:48 BOBs_secretfile.txt[JOE@clone7 ~]$

If JOE isnot in the sudoers file, he will be denied:

[JOE@clone7 ~]$ sudo -u BOB  ls -lrt /home/BOB[sudo] password for JOE: JOE is not in the sudoers file.  This incident will be reported.[JOE@clone7 ~]$

Another example, to delete a file (e.g. Example.php) normal users do not typically have permissions for, the user can type:

[JOE@clone7 ~]$ sudo rm -r Example.php[sudo] password for JOE: [JOE@clone7 ~]$

When thepassword is entered correctly (assuming proper entries in the sudoers file), the computer would then run the command.

Programs with a graphicaluser interface can also be run with sudo, but it may mess them up. Variousdesktops for Unix-like systems usually have their own version of sudo for such programs.

Thisshort article abouttechnology can be made longer. You can help Wikipedia byadding to it.
Retrieved from "https://simple.wikipedia.org/w/index.php?title=Sudo&oldid=10025878"
Category:
Hidden category:

[8]ページ先頭

©2009-2026 Movatter.jp