Need help about user access


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Need help about user access
# 1  
Old 01-15-2012
Need help about user access

Hi frds,

I have got a script restart.sh that kills and restarts a process. This scripts runs under a user called USER1 who is a normal user. Now my requirement is that i got other user named USER2 who should be able to run that script as USER1 as we dont want to share the password of user1 we created other user called user2 with similar access. Any inputs will be great.
OS: centos 5.4
Thanks in advance

Last edited by phanidhar6039; 01-16-2012 at 06:06 AM..
# 2  
Old 01-15-2012
You don't state the UNIX OS.

In general try one of these:
A. use sudo and /etc/sudoers to control running the script with setuid.
B. create a setuid executable (best using C/C++) to run the process as root which then becomes the user. Only allow USER1 and USER2 (put them in the same group) to run the executable.


For other systems like solaris there are other ways to do this. Next time, please be sure to include your OS.
# 3  
Old 01-16-2012
Quote:
Originally Posted by jim mcnamara
You don't state the UNIX OS.

In general try one of these:
A. use sudo and /etc/sudoers to control running the script with setuid.
B. create a setuid executable (best using C/C++) to run the process as root which then becomes the user. Only allow USER1 and USER2 (put them in the same group) to run the executable.


For other systems like solaris there are other ways to do this. Next time, please be sure to include your OS.
Hi,

OS is centos 5.4. I was told this script should run as user1 instead of as root. This is what i have done so far. in sudoers file i have written as below

USER2 ALL=(USER1) NOPASSWD: /home/user1/restart.sh

I have assigned the USER2 primary group of USER1. I have set the suid and sgid on /home/user2/ by using chmod +s and given 774 permissions both on home dir and on script of user2. tried logging this way now from user2 and run script.
sudo -u user1 /home/user1/restart.sh

But still doesnt workout. anyhelp will be great as i want to restart the script as user1 by user2 so that in the process list it shows that the process has been started by same user called user1 so that the cronjobs associted with that script doesnt fail.

Last edited by phanidhar6039; 01-16-2012 at 03:02 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

User permission access

Hi folks, I am trying to grant the access like below items using the setfacl command, but i couldn't achieve as what I required. any other possibility. username : testing Readonly access in /form_dl/system/prd/logs Write only access in /form_dl/system/prd/deploy No access to other... (0 Replies)
Discussion started by: gsiva
0 Replies

2. UNIX for Dummies Questions & Answers

Restrict user access.

Hi All, How can we restrict a particular user access to a particular shell in solaris 10. Thanks in Advance. (5 Replies)
Discussion started by: rama krishna
5 Replies

3. Shell Programming and Scripting

Removing user access using user id

I have multiple .prm files that contain user ID's. The .prm files reside in multiple directories that allow users access to different areas of the system. (see below) current directory /apps/fourgen/accounting/menu drwxrwxrwx 16 phil infotech 512 Sep 7 2002 apmenu... (8 Replies)
Discussion started by: jamba1
8 Replies

4. AIX

sudo user access

I have installed sudo on AIX 6100-04 and want to know how do I set it up for a user to be able to run only some commands? I want to give the user the rights to only cd to certain directories and run the ls command to name a few? Are there any issues with running sudo when the user is forced to... (2 Replies)
Discussion started by: daveisme
2 Replies

5. AIX

Limit user access

We have gotten an application that will read and display logs in a report format. The application need a user name and password to access the AIX servers where the logs reside. My problem is the logs are in a few different file systems on the server. Is there any way to lock the user to only the... (1 Reply)
Discussion started by: daveisme
1 Replies

6. AIX

User access

Is there any way I can restrict a user to 1 directory when logging in but give the access to another directory? For example restrict the user to /home/user at login but also allow then to access /opt/data/user. (1 Reply)
Discussion started by: daveisme
1 Replies

7. UNIX for Dummies Questions & Answers

User Access Rights

Hi Folks, My problem is an easy one for the experts here. All my applications run using a user id that creates files with only the following default rights: -rw-r----- I want to modify this user's account such that it creates files that assign read access to the everyone group by default:... (7 Replies)
Discussion started by: umairrahman
7 Replies

8. UNIX for Dummies Questions & Answers

user with limited access

dear guys, sorry for asking a noob :p question, tried to search the forum for an answer but couldn't find one, i am running solaris 10 and i would like to create a user with limited access to view only one directory, the directory already exist, is this possible:confused:? thanks and regards (4 Replies)
Discussion started by: q8devilish
4 Replies

9. Red Hat

New RH User - Access Denied

Hi, We were just recently given a new VM instance with Red Hat linux. The only user account that can log in successfully is the root account. I made sure that the user z021407 has access to their directory and the account can read the home directory, but I can't log in with the new account... (2 Replies)
Discussion started by: edrichard
2 Replies

10. UNIX for Advanced & Expert Users

user has access only to one dir

Hello i want to ask how can i let a newly created user to access only one directory and not any other directory at all.: (1 Reply)
Discussion started by: learn82
1 Replies
Login or Register to Ask a Question