Sponsored Content
Top Forums Shell Programming and Scripting How to give root access to non root user? Post 302800719 by rbatte1 on Tuesday 30th of April 2013 11:16:21 AM
Old 04-30-2013
Have a look at the manual pages for sudo and sudoers if they are installed. If not, have a look here

Basically, you can write rules for can be allowed to run certain commands. These can be scripts, or called in scripts.

Consider
Code:
$ ls -l
-rwxr-xr-x 1 ABCDE123 users        327 Jan  3 16:25 my_file
$ sudo chown ZYX99999 my_file
$ ls -l 
-rwxr-xr-x 1 ZYX99999 users        327 Jan  3

You could also do things such as:-
Code:
$ cat priv_script
#!/bin/ksh

print "I am running as `id -un`"
$ priv_script
I am running as ABCDE123
$ sudo su - ZYX99999 -c "/common/scripts/priv_script"
I am running as ZYX99999
$
$ sudo -u ZYX99999 ./priv_script
I am running as ZYX99999
$


Have a good search around these boards for hint on sudo too as many questions have already been asked and answered.



I hope that this helps,

Robin
Liverpool/Blackburn
UK
 

10 More Discussions You Might Find Interesting

1. Linux

how to access root priveliges if root password is lost

wish to know how to access root password it root password is forgotten in linux (1 Reply)
Discussion started by: wojtyla
1 Replies

2. HP-UX

user commands without root access

Hi I have been asked to find out how to 1) create users 2) reset passwords 3) kill processes that may require root privileges without having root password, sudo rights or rights to passwd command Any ideas? Thanks in advance (1 Reply)
Discussion started by: emealogistics
1 Replies

3. UNIX for Dummies Questions & Answers

How to give an ordinary user the superuser (root) ID which is 0

How to give an ordinary user the superuser (root) ID which is 0 (9 Replies)
Discussion started by: sharaola
9 Replies

4. Solaris

I can not access root user through LAN

Dear i have installed Solaris 10 on SUN V240 after installation i can not access system through root user if i access system through any other user it conects but root is not connecting through LAN if i connect through SC and then access root though cosole -f command it also works kindly... (6 Replies)
Discussion started by: rizwan225
6 Replies

5. Shell Programming and Scripting

access user history as root

Hi, I need to access a user's command history. However, the dilemma is that he is logged in and so his current history is not yet flushed to .bash_history file which gets flushed when he logs out. Is there a way I can still access his most recent history? thank you, S (4 Replies)
Discussion started by: sardare
4 Replies

6. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

7. SuSE

Auditors want more security with root to root access via ssh keys

I access over 100 SUSE SLES servers as root from my admin server, via ssh sessions using ssh keys, so I don't have to enter a password. My SUSE Admin server is setup in the following manner: 1) Remote root access is turned off in the sshd_config file. 2) I am the only user of this admin... (6 Replies)
Discussion started by: dvbell
6 Replies

8. UNIX for Advanced & Expert Users

One user to su to another without allowing root access and password

Hello Gurus, I want One user to su to another without allowing root access and password. I want to run a specific command as below from user am663: --------------------------------------------------------- sudo -u appsprj4 /home/appsrj4/scripts/start_apache.sh ------------------- But... (6 Replies)
Discussion started by: pokhraj_d
6 Replies

9. Solaris

Sudo access of rm to non-root user

Hello, It is Solaris-10. There is a file as /opt/vpp/dom1.2/pdd/today_23. It is always generated by root, so owned by root only. This file has to be deleted as part of application restart always and that is done by app_user and SA is always involved to do rm on that file. Is it possible to give... (9 Replies)
Discussion started by: solaris_1977
9 Replies

10. UNIX for Advanced & Expert Users

Non root user access to /dev/mem

Hi All, I have to install an application which needs access to system BIOS information. The application needs to be installed by non root user. How would i grant read privileges of /dev/mem file to the non root user so that it can capture system BIOS information while running the application?... (13 Replies)
Discussion started by: Soumyadip Dutta
13 Replies
su-to-root(1)						      Debian GNU/Linux manual						     su-to-root(1)

NAME
su-to-root - A simple script to give an `interactive' front-end to su. It can be used in menu entry commands to ask for the root password SYNOPSIS
su-to-root [-X] [-p <user>] -c <command> DESCRIPTION
Most menu entries simply start an editor or a game or whatever. But some menu entries would like to give the user the ability to change important settings in the system, that require root privileges. su-to-root can be used to ask for the root password. OPTIONS
-c <command> The command to execute as a string. This option is mandatory. -p <user> The name of the user to change to, instead of root. -X The command is a X11 program that does not require a terminal. This is to be used with menu entries that declare needs="X11". ENVIRONMENT
SU_TO_ROOT_X Select the su-like program called by su-to-root -X. Supported values are gksu, kdesu, kde4su, ktsuss, sux, gksudo and kdesudo. kde4su denotes the KDE4 version of kdesu. When this variable is not set su-to-root will currently try to use gksu, kdesu, kde4su, ktsuss, sux and the built-in code, in that order with the exception that under a KDE session, kdesu and kde4su are prefered over gksu. The exact set of programs to try and their order is subject to change without notice. SU_TO_ROOT_SU Select the su-like program used in text mode. Supported values are sudo, sux and su, the later being the default. FILES
/etc/su-to-rootrc ~/.su-to-rootrc su-to-root will source these files at startup in this order. This lets you define and modify the environment variables above without restarting your X session. COPYING
su-to-root is distributed under the GNU General Public License. (GPL 2.0 or greater). AUTHORS
Joost Witteveen <joostje@debian.org> X11 support by Morten Brix Pedersen and Bill Allombert <ballombe@debian.org> SEE ALSO
update-menus(1), menufile(5), /usr/share/doc/menu/html Debian Project 20 October 1998 su-to-root(1)
All times are GMT -4. The time now is 12:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy