Skip to main content

[HDGEM] How To Give a Linux User Root-level Access Using sudo

[email protected] [~]# visudo
This will open the sudoers file in the vi editor. In order to give the user full root privileges, add the following line to the file:
example ALL=(ALL) ALL
If you only want a user to run certain commands as root, you can create a command alias in your sudoers file, like so:
User_Alias ADMINS = example
Cmnd_Alias HTTPD = /etc/init.d/httpd
ADMINS ALL = HTTPD

User_Alias creates a group of users that you can then assign command aliases to. (Additional users can be listed on the same line, separated by commas.) Cmnd_Alias then lists the various commands that the users of that Alias can run. The user alias is then assigned the command alias. The example user is now able to run the apache init script with full root privileges, which allows him to start, stop, and restart apache.
With this configuration, the user will have to type in his own password when he wishes to run sudo. If you don't need the user to type a password every time he runs a sudo command, just replace the last line of the above with:
ADMINS ALL = NOPASSWD: HTTPD

This should get you started applying sudo privileges to your users. If you have more detailed needs, the man page for sudo is thorough and readable. The sudoers file has a separate man page that details all the configuration options.



--
Posted By Blogger to HDGEM at 1/25/2017 07:01:00 AM
Post a Comment

Popular posts from this blog

How to reset password of Jenkins

Reset password of JenkinsPrefer way, No securities were harmedSee also:
What is Jenkins' initial admin password

To reset it without disabling security if you're using matrix permissions (probably easily adaptable to other login methods): In config.xml, set disableSignup to false.Restart Jenkins.Go to the Jenkins web page and sign up with a new user.In config.xml, duplicate one of the <permission>hudson.model.Hudson.Administer:username</permission> lines and replace username with the new user.If it's a private server, set disableSignup back to true in config.xml.Restart Jenkins.Go to the Jenkins web page and log in as the new user.Reset the password of the original user.Log in as the original user. Optional cleanup: Delete the new user.Delete the temporary <permission> line in config.xml.
Alternative way:
ssh to the server, disable authentication, set the password via the Jenkins Web UI, then enable authentication.

How to Remove / Hide "Powered by Blogger" (Attribution Gadget)

Settings -> Template -> Edit HTML -> Jump to widget: choose Attribution1

Change it to:

<b:widget id='Attribution1' locked='false' mobile='no' title='' type='Attribution'/>

Go to Layout, remove Attribution1 widget.

To hide: Template -> Customize ->  Advanced -> Add CSS - Paste the following code  -> Apply to Blog:
#Attribution1 { display: none!important; }