LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-06-2014, 06:40 AM   #1
__vivek__
LQ Newbie
 
Registered: Jul 2013
Location: INDIA
Distribution: CentOS
Posts: 7

Rep: Reputation: Disabled
Elevate user privilege to root in CentOS


I need to run a script when a particular user logs in, which along with other things need to be able to change IP address of machine too.

SO I created a user named vivek, set password and changed passwd file like -

vivek:x:5002:0::/home/vivek:/root/scripts/myscript.sh


now this scripts just copy the file /tmp/ifcfg-eth0 -> /etc/sysconfig/network-scripts/ifcfg-eth0

which fails with error msg::

cp: cannot create regular file `/etc/sysconfig/network-scripts/ifcfg-eth0': Permission denied

So Its clear that i am able to run script on login but it fails when it tries to copy ifcfg-eth0 file.

Any help will be appreciated..

Thanks
 
Old 10-06-2014, 07:06 AM   #2
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/Fedora
Posts: 38

Rep: Reputation: Disabled
Checked /var/log/audit/audit.log ?
Maybe it's selinux ?
 
Old 10-06-2014, 07:09 AM   #3
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/Fedora
Posts: 38

Rep: Reputation: Disabled
If you are running selinux, which you should

It's easier to figure out if there is a problem if you do this.

yum install setroubleshoot setools

sealert -a /var/log/audit/audit.log
 
Old 10-07-2014, 04:48 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by __vivek__ View Post
Code:
cp: cannot create regular file `/etc/sysconfig/network-scripts/ifcfg-eth0': Permission denied
This isn't about SELinux but about DAC rights: reset "vivek" account to use uid 5002 and group 5002, set up SSH, force pubkey auth plus white list IP address, then set up Sudo and link command to user.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Want to run a script that needs root [to mount network drives] privilege as user DiBosco Programming 6 02-27-2013 06:50 AM
Privilege Escalation - Getting 'root' privilege Rahil Parikh Linux - Security 2 12-02-2010 01:04 AM
[SOLVED] Ubuntu: How do you give sftp root privilege to user? shokemyster Linux - Newbie 17 09-23-2010 12:31 AM
run a specific script with root privilege as any user(possibly with ssh) z940303 Programming 5 09-05-2007 08:20 PM
assign user with root privilege and permisssion to access system files eyt Linux - General 6 07-27-2007 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration