Setup SUDO For a User on Linux Server


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Setup SUDO For a User on Linux Server
# 1  
Old 07-23-2010
Setup SUDO For a User on Linux Server

Hello! Can anyone please assist:

Question:
On Linux Server I have created two users John and Matt. I want to give both the users the ability to run 'more' and 'tail -f' commands on the log file in the directory /var/log/test.log. I do not want to give them SU rights.

Can any one please assit how to setup sudoers

Thanks in advance.
# 2  
Old 07-23-2010
/etc/sudoers
# 3  
Old 07-23-2010
What I would do is write a script that displays the log how you want it then add the following to sudoers.

Code:
Cmnd_Alias     MYSCRIPTS=/path/to/script/myscriptname, /path/to/another/script/myotherscript

john    ALL=(ALL) MYSCRIPTS
matt    ALL=(ALL) MYSCRIPTS

The users would have to use the following command then enter their password:

Code:
# sudo /path/to/script/myscriptname

Make sure the users DON'T have write access to the script or they can edit the script and put what ever they want in it.
# 4  
Old 07-23-2010
Thank you very much IKON. It works!!!
# 5  
Old 07-25-2010
Ikon, use a group my boy. hehehe

Standardization is king!

Only reason why I actually think I should mention this is, because at work doing this nearly every day, if you continue to add users into the sudoers file then you may just mistype something and kill sudo sys-wide. Better to have groups you can simply add users to, again, you will still need to initially config sudoers, but, adding more people down the track is easier.

And again, you are supposed to use visudo to get around /etc/sudoers corruption, but, as Jokob mentioned the file itself, manual editing should be as limited as possible.
# 6  
Old 07-26-2010
The above works great...but how can we restrict the users John and Matt to stop executing the scripts in other directories?

or simply I do not want them to access any directory (and data in them) except the directory the script is saved (for example the script is saved in /tmp).

Thanks.
# 7  
Old 07-26-2010
Problem is you are allowing them to tail a file, this means they will be able to look at the contents of pretty much anything they want.

for instance:
sudo tail /root/.ssh/authorized_keys

Catch my drift???

I would say chgrp the files you want them to be able to tail, to a newly created group, toss the old group owner into that group and add matt and john to the new group.

This way they can only access the files that you chgrp to the new group.

This seems to becoming more of a permissions question than a sudo question...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Setup Samba Server to always ask user and password

How do I setup a Samba server to always ask to user and password, when a windows user, prints your files using a shared printer through a Samba Linux Server (CUPS)? (0 Replies)
Discussion started by: viga
0 Replies

2. UNIX for Dummies Questions & Answers

Samba setup in virtual server environment Windows/ Linux

I have a home network set up that consists of a few windows clients and 3 centos, and 1 suse client. These are all virtual machines, VMware Workstation. One centos vm is set to be the Samba server. Do I need Samba set up on the other Linux clients?I have no problem seeing the windows clients... (0 Replies)
Discussion started by: ktb231
0 Replies

3. Linux

Linux- Useradd / sudo user

Hi, I am new in linux. Please help for create new user and also need to give sudo access in linux box. Please help me Now i am having new access Thanks, Mani (2 Replies)
Discussion started by: Mani_apr08
2 Replies

4. Red Hat

setup sudo for cmd exec w/o password

i need to set up a user to execute a restricted command as another user and to be able to do so without entering a password. I understand the security concerns but let's not go there, unless you are really compelled to do so... The directive to permit is that I believe should work and did add to... (2 Replies)
Discussion started by: twk
2 Replies

5. AIX

sudo setup

I am working on setting sudo on a few AIX servers and wanted to know how to give users root access without allowing them access to the sudo logs, sudoers files and the /etc/security directory. (3 Replies)
Discussion started by: daveisme
3 Replies

6. Linux

problems in linux mail server setup

hi i want to set up LInux mail server for intranet purpose. i used following document as reference Linux Mail Server softwares used are : Postfix # pre installed Procmail # pre installed Fetchmail # pre installed SpamBayes Mutt #... (1 Reply)
Discussion started by: zedex
1 Replies

7. UNIX for Advanced & Expert Users

Remove and block a user from Linux server

Hi, Can anyone please guide me how can I remove/block a user from a server access. /usr/sbin/adduser -d /home/john john echo ****** | passwd --stdin john I used the above command to add a user "john". How do I delete and block john. Appreciate your responses. (1 Reply)
Discussion started by: sureshcisco
1 Replies

8. AIX

NIM server setup on etherchannel setup environment

I know that IBM's official stance is that NIM does not work on etherchannel environment, but has anyone able to get around it? I'm working on a p5-590 LPAR system, and the NIM master and clients are all on the same frame. Any help is appreciated. (1 Reply)
Discussion started by: pdtak
1 Replies

9. Linux

how to setup a virtual IP to control 2 server load for linux

Hi anyone know how to setup a setup a virtual IP to control 2 server load for linux? i only have 2 server, i don want to buy another just for the load balance... is there a way to do it? Sumemr (0 Replies)
Discussion started by: summerpeh
0 Replies

10. UNIX for Dummies Questions & Answers

setup of user a/c in mysql in linux

Hi Friends, I am new user of linux operating system. I wanted to install a software but facing a difficulty. I am not able to proceed to the next statement without resolving this. WFT is the software i need for my purpose. Setup a MySQL user account for WTF that will have access to ... (1 Reply)
Discussion started by: alma
1 Replies
Login or Register to Ask a Question