SlideShare ist ein Scribd-Unternehmen logo
1 von 7
SUDO
        sudo is a Linux command used to execute programs as the root, or "super
user." sudo is a shortening of "super user do." One uses sudo when they need to run
a command or program as root, but do not wish to log out or switch their entire
shell to root privileges (like they could do with the sudo command).
      The file sudoers defines per user or per group what commands can be run with
sudo. This file is edited with the command visudoers
        command: sudo /opt/lampp/lampp
The above command is used for check whether lampp is installed are not.....
    command: sudo /opt/lampp/lampp/start
The above command is used for start the lampp
    command: sudo /opt/lampp/lampp/stop
The above command is used for start the lampp
   The following procedure will guide you to work in sudo:
   1. Log in Linux graphical mode as usual, answering    your username and
   password
   2. Open a terminal, shell window.
   3. at the bash shell prompt $ type sudo -v
   4. Linux will ask you for a password -- enter the password of your account For
   the next 5 minutes it will not ask you for your password when you use sudo.
   5. After Linux returns the bash shell prompt $ type sudo su - Since you already
   have root privileges, it will not ask you for the root password
   6.Linux will reply with something like [root@mislab01x root]#
   Linux accepts your login as root and gives you the root path. You are now ready
   to start X Windows as root!
   7.at the prompt # type startx -- :1 vt8 This will start another X Windows session
   with root privileges
   8.You can now use all graphical tools requiring root privileges.




About sudo:
Allows a user with proper permissions to execute a command as the
superuser or other user.
Syntax
sudo -K | -L | -V | -h | -k | -l | -v
sudo [-HPSb] [-a auth_type] [-c class|-] [-p prompt] [-u username|#uid] {-e file [...] |
-i | -s | command}

-H      The -H (HOME) option sets the HOME environment variable to the homedir
        of the target user (root by default) as specified in passwd. By default, sudo
        does not modify HOME (see set_home and always_set_home in sudoers).
-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.
-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.
-P      The -P (preserve group vector) option causes sudo to preserve the invoking
        user's group vector unaltered. By default, sudo will initialize 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.
-S      The -S (stdin) option causes sudo to read the password from the standard
        input instead of the terminal device.
-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.
-a      The -a (authentication type) option causes sudo to use the specified
        authentication type when validating the user, as allowed by /etc/login.conf.
        The system administrator may specify a list of sudo-specific authentication
        methods by adding an "auth-sudo" entry in /etc/login.conf. This option is
        only available on systems that support BSD authentication where sudo has
        been configured with the --with-bsdauth option.
-b      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.
-c      The -c (class) option causes sudo to run the specified command with
        resources limited by the specified login class. The class argument can be
        either a class name as defined in /etc/login.conf, or a single '-' character.
        Specifying a class of - indicates that the com-
mand should be run restricted by the default login capabilities for the user
     the command is run as. If the class argument specifies an existing user
     class, the command must be run as root, or the sudo command must be
     run from a shell that is already root. This option
     is only available on systems with BSD login classes where sudo has been
     configured with the --with-logincap option.
-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.
Tem
porar
y
copie
s are
made
of
the
files
to be
edite
d
with
the
owne
r set
to
the
invok
ing
user.

2.
The
edito
r
speci
fied
by
the
VISU
AL or
EDIT
OR
envir
onm
ent
varia
bles
is run
to
edit
-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
     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 initializes 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 (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.
-l   The -l (list) option will list out the allowed (and forbidden) commands for
     the user on the current host.
-p   The -p (prompt) option allows you to override the default password prompt
     and use a custom one. The following percent (`%') escapes are supported:
%u
exp
an
de
d
to
the
inv
oki
ng
use
r's
logi
n
na
me

%U
exp
an
de
d
to
the
logi
n
na
me
of
the
use
r
the
co
m
ma
nd
will
be
run
as
(de
fau
-s   The -s (shell) option runs the shell specified by the SHELL environment
     variable if it is set or the shell as specified in passwd.
-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. Note that
     if the targetpw Defaults option is set (see sudoers) it is not possible to run
     commands with a uid not listed in the password database.




-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.
--   The -- flag indicates that sudo should stop processing command line
     arguments. It is most useful in conjunction with the -s flag.

Weitere ähnliche Inhalte

Was ist angesagt?

Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell ScriptingJaibeer Malik
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in LinuxAnu Chaudhry
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebookYash Gulati
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Scriptstudent
 
Lpi 101 study_guide
Lpi 101 study_guideLpi 101 study_guide
Lpi 101 study_guideousman1
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programmingsudhir singh yadav
 
Rhel 6.2 complete ebook
Rhel 6.2  complete ebookRhel 6.2  complete ebook
Rhel 6.2 complete ebookYash Gulati
 
Fuse- Filesystem in User space
Fuse- Filesystem in User space Fuse- Filesystem in User space
Fuse- Filesystem in User space Danny Tseng
 
Lpi Part 1 Linux Fundamentals
Lpi Part 1 Linux FundamentalsLpi Part 1 Linux Fundamentals
Lpi Part 1 Linux FundamentalsYemenLinux
 
Writing flexible filesystems in FUSE-Python
Writing flexible filesystems in FUSE-PythonWriting flexible filesystems in FUSE-Python
Writing flexible filesystems in FUSE-PythonAnurag Patel
 
Linux shell env
Linux shell envLinux shell env
Linux shell envRahul Pola
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity TipsKeith Bennett
 

Was ist angesagt? (20)

Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebook
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Script
 
Lpi 101 study_guide
Lpi 101 study_guideLpi 101 study_guide
Lpi 101 study_guide
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Unix lab manual
Unix lab manualUnix lab manual
Unix lab manual
 
Rhel 6.2 complete ebook
Rhel 6.2  complete ebookRhel 6.2  complete ebook
Rhel 6.2 complete ebook
 
Fuse- Filesystem in User space
Fuse- Filesystem in User space Fuse- Filesystem in User space
Fuse- Filesystem in User space
 
Clase4 (consola linux)
Clase4 (consola linux)Clase4 (consola linux)
Clase4 (consola linux)
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Lpi Part 1 Linux Fundamentals
Lpi Part 1 Linux FundamentalsLpi Part 1 Linux Fundamentals
Lpi Part 1 Linux Fundamentals
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Writing flexible filesystems in FUSE-Python
Writing flexible filesystems in FUSE-PythonWriting flexible filesystems in FUSE-Python
Writing flexible filesystems in FUSE-Python
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
 

Andere mochten auch

PräSentation
PräSentationPräSentation
PräSentationChrmarx
 
Handling tree control events
Handling tree control eventsHandling tree control events
Handling tree control eventsHemakumar.S
 
Comparison between various version of tally
Comparison  between various version of tallyComparison  between various version of tally
Comparison between various version of tallyparineeta0611
 
Cheshire Staging Brochure
Cheshire Staging BrochureCheshire Staging Brochure
Cheshire Staging BrochureJustin Cheshire
 
Pop upbutton control
Pop upbutton controlPop upbutton control
Pop upbutton controlHemakumar.S
 
23427130 tally-9-2-notes
23427130 tally-9-2-notes23427130 tally-9-2-notes
23427130 tally-9-2-notesparineeta0611
 
Tdl reference manual
Tdl reference manualTdl reference manual
Tdl reference manualparineeta0611
 
Physical processes
Physical processesPhysical processes
Physical processesimranlayyah
 
Factors affecting of filtration
Factors affecting of filtrationFactors affecting of filtration
Factors affecting of filtrationimranlayyah
 

Andere mochten auch (17)

45 Lessons In Life
45 Lessons In Life45 Lessons In Life
45 Lessons In Life
 
Tile list
Tile listTile list
Tile list
 
Cheshire AV 1.21.10
Cheshire AV 1.21.10Cheshire AV 1.21.10
Cheshire AV 1.21.10
 
PräSentation
PräSentationPräSentation
PräSentation
 
Handling tree control events
Handling tree control eventsHandling tree control events
Handling tree control events
 
Comparison between various version of tally
Comparison  between various version of tallyComparison  between various version of tally
Comparison between various version of tally
 
Reading123
Reading123Reading123
Reading123
 
Cheshire Staging Brochure
Cheshire Staging BrochureCheshire Staging Brochure
Cheshire Staging Brochure
 
Cheshire Overview
Cheshire OverviewCheshire Overview
Cheshire Overview
 
List control
List controlList control
List control
 
Pop upbutton control
Pop upbutton controlPop upbutton control
Pop upbutton control
 
23427130 tally-9-2-notes
23427130 tally-9-2-notes23427130 tally-9-2-notes
23427130 tally-9-2-notes
 
Tdl reference manual
Tdl reference manualTdl reference manual
Tdl reference manual
 
Tally 6.3
Tally  6.3Tally  6.3
Tally 6.3
 
Physical processes
Physical processesPhysical processes
Physical processes
 
Tally 9
Tally 9Tally 9
Tally 9
 
Factors affecting of filtration
Factors affecting of filtrationFactors affecting of filtration
Factors affecting of filtration
 

Ähnlich wie Sudo

Sudo & su commands
Sudo & su commandsSudo & su commands
Sudo & su commandsMeenu Chopra
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurityricharddxd
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptxHarsha Patel
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptxHarsha Patel
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administratorDinesh jaisankar
 
Unixcommandsinetltesting 130712050932-phpapp01
Unixcommandsinetltesting 130712050932-phpapp01Unixcommandsinetltesting 130712050932-phpapp01
Unixcommandsinetltesting 130712050932-phpapp01Gyanendra Kumar
 
ManagingLocalLinuxUsersandGroups(2)
ManagingLocalLinuxUsersandGroups(2)ManagingLocalLinuxUsersandGroups(2)
ManagingLocalLinuxUsersandGroups(2)Bipul Kumar
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installationAnkit Desai
 
Linux advanced privilege escalation
Linux advanced privilege escalationLinux advanced privilege escalation
Linux advanced privilege escalationJameel Nabbo
 
linux_Commads
linux_Commadslinux_Commads
linux_Commadstastedone
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common CommandJeff Yang
 

Ähnlich wie Sudo (20)

Sudo & su commands
Sudo & su commandsSudo & su commands
Sudo & su commands
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurity
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administrator
 
Solaris basics
Solaris basicsSolaris basics
Solaris basics
 
User management
User managementUser management
User management
 
Unixcommandsinetltesting 130712050932-phpapp01
Unixcommandsinetltesting 130712050932-phpapp01Unixcommandsinetltesting 130712050932-phpapp01
Unixcommandsinetltesting 130712050932-phpapp01
 
ManagingLocalLinuxUsersandGroups(2)
ManagingLocalLinuxUsersandGroups(2)ManagingLocalLinuxUsersandGroups(2)
ManagingLocalLinuxUsersandGroups(2)
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
 
Linux advanced privilege escalation
Linux advanced privilege escalationLinux advanced privilege escalation
Linux advanced privilege escalation
 
Linux Security Crash Course
Linux Security Crash CourseLinux Security Crash Course
Linux Security Crash Course
 
Linux
Linux Linux
Linux
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Linux Security
Linux SecurityLinux Security
Linux Security
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Unix Administration 3
Unix Administration 3Unix Administration 3
Unix Administration 3
 
linux_Commads
linux_Commadslinux_Commads
linux_Commads
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
 

Mehr von Hemakumar.S

Health heart1 hemakumar
Health heart1 hemakumarHealth heart1 hemakumar
Health heart1 hemakumarHemakumar.S
 
Combobox with effect
Combobox with effectCombobox with effect
Combobox with effectHemakumar.S
 
Expanding a tree node
Expanding a tree nodeExpanding a tree node
Expanding a tree nodeHemakumar.S
 
Navigation keys in tree controls
Navigation keys in tree controlsNavigation keys in tree controls
Navigation keys in tree controlsHemakumar.S
 
Pop up menubutton control
Pop up menubutton controlPop up menubutton control
Pop up menubutton controlHemakumar.S
 
Specifying tree control icons
Specifying tree control iconsSpecifying tree control icons
Specifying tree control iconsHemakumar.S
 
Tree user interaction
Tree user interactionTree user interaction
Tree user interactionHemakumar.S
 

Mehr von Hemakumar.S (14)

Health heart1 hemakumar
Health heart1 hemakumarHealth heart1 hemakumar
Health heart1 hemakumar
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux
LinuxLinux
Linux
 
Drag and drop
Drag and dropDrag and drop
Drag and drop
 
Combobox with effect
Combobox with effectCombobox with effect
Combobox with effect
 
Expanding a tree node
Expanding a tree nodeExpanding a tree node
Expanding a tree node
 
Horizontal list
Horizontal listHorizontal list
Horizontal list
 
Image control
Image controlImage control
Image control
 
Navigation keys in tree controls
Navigation keys in tree controlsNavigation keys in tree controls
Navigation keys in tree controls
 
Pop up menubutton control
Pop up menubutton controlPop up menubutton control
Pop up menubutton control
 
Specifying tree control icons
Specifying tree control iconsSpecifying tree control icons
Specifying tree control icons
 
Tree control
Tree controlTree control
Tree control
 
Tree user interaction
Tree user interactionTree user interaction
Tree user interaction
 

Sudo

  • 1. SUDO sudo is a Linux command used to execute programs as the root, or "super user." sudo is a shortening of "super user do." One uses sudo when they need to run a command or program as root, but do not wish to log out or switch their entire shell to root privileges (like they could do with the sudo command). The file sudoers defines per user or per group what commands can be run with sudo. This file is edited with the command visudoers command: sudo /opt/lampp/lampp The above command is used for check whether lampp is installed are not..... command: sudo /opt/lampp/lampp/start The above command is used for start the lampp command: sudo /opt/lampp/lampp/stop The above command is used for start the lampp The following procedure will guide you to work in sudo: 1. Log in Linux graphical mode as usual, answering your username and password 2. Open a terminal, shell window. 3. at the bash shell prompt $ type sudo -v 4. Linux will ask you for a password -- enter the password of your account For the next 5 minutes it will not ask you for your password when you use sudo. 5. After Linux returns the bash shell prompt $ type sudo su - Since you already have root privileges, it will not ask you for the root password 6.Linux will reply with something like [root@mislab01x root]# Linux accepts your login as root and gives you the root path. You are now ready to start X Windows as root! 7.at the prompt # type startx -- :1 vt8 This will start another X Windows session with root privileges 8.You can now use all graphical tools requiring root privileges. About sudo:
  • 2. Allows a user with proper permissions to execute a command as the superuser or other user. Syntax sudo -K | -L | -V | -h | -k | -l | -v sudo [-HPSb] [-a auth_type] [-c class|-] [-p prompt] [-u username|#uid] {-e file [...] | -i | -s | command} -H The -H (HOME) option sets the HOME environment variable to the homedir of the target user (root by default) as specified in passwd. By default, sudo does not modify HOME (see set_home and always_set_home in sudoers). -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. -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. -P The -P (preserve group vector) option causes sudo to preserve the invoking user's group vector unaltered. By default, sudo will initialize 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. -S The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device. -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. -a The -a (authentication type) option causes sudo to use the specified authentication type when validating the user, as allowed by /etc/login.conf. The system administrator may specify a list of sudo-specific authentication methods by adding an "auth-sudo" entry in /etc/login.conf. This option is only available on systems that support BSD authentication where sudo has been configured with the --with-bsdauth option. -b 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. -c The -c (class) option causes sudo to run the specified command with resources limited by the specified login class. The class argument can be either a class name as defined in /etc/login.conf, or a single '-' character. Specifying a class of - indicates that the com-
  • 3. mand should be run restricted by the default login capabilities for the user the command is run as. If the class argument specifies an existing user class, the command must be run as root, or the sudo command must be run from a shell that is already root. This option is only available on systems with BSD login classes where sudo has been configured with the --with-logincap option. -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:
  • 4. 1. Tem porar y copie s are made of the files to be edite d with the owne r set to the invok ing user. 2. The edito r speci fied by the VISU AL or EDIT OR envir onm ent varia bles is run to edit
  • 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 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 initializes 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 (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. -l The -l (list) option will list out the allowed (and forbidden) commands for the user on the current host. -p The -p (prompt) option allows you to override the default password prompt and use a custom one. The following percent (`%') escapes are supported:
  • 7. -s The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd. -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. Note that if the targetpw Defaults option is set (see sudoers) it is not possible to run commands with a uid not listed in the password database. -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. -- The -- flag indicates that sudo should stop processing command line arguments. It is most useful in conjunction with the -s flag.