LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-03-2014, 08:28 AM   #1
tuscani
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Rep: Reputation: Disabled
Permissions Issue CentOS 5


First I am a Windows guy who has inherited some CentOS 5 servers so bear with me.

Hopefully this is easy... essentially I am just trying to grant a new user account read and execute access to a folder and all sub-folders and files. I am logged into the server as root currently. I have run the following commands:

useradd -g appsupport appsupport
passwd appsupport
chgrp appsupport /usr/local/bin
chmod go+rx -R /usr/local/bin

I can SSH into the server but when I try and open a file with vi I get "Permission Denied".

Permissions on the file are which resides in bin are:

-rwx------ 1 root root 3070 Jul 26 2012 NEW.pl

I even tried adding the user to the "root" group as a test and I still get "Permission Denied"

What am I missing? PS.. Also want to note that it is important that I do not overwrite or change any existing permissions.

Thanks!
 
Old 06-03-2014, 09:55 AM   #2
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
The file NEW.pl has read, write, and execute permissions for the root user only(-rwx------).
You want the permissions to look like this to allow other users to read and execute: (-rwx---r-x)

Try this:
# chmod o+rx /usr/local/bin/NEW.pl

Once you do this, ALL users on the system can run that file.

If you only wanted this one specific user to run the file, I suggest creating a group, adding the user to the group, changing group ownership of NEW.pl to the group, giving read and execute to the group on NEW.pl, and taking away read and execute from other on NEW.pl (if those permissions exist).
 
Old 06-03-2014, 11:02 AM   #3
tuscani
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks.. I ran the following (the folder that NEW.pl is in):

chmod o+rx -R /usr/local/bin

I see the permission on NEW.pl changed.. but I still cannot see the content via vi

-rwx---r-x 1 root root 3210 Apr 15 13:53

"NEW.pl" [Permission Denied] 0,0-1 All

Do I need write permissions to be able to see the contents of the file via vi? I get the same error just trying to cat the file. cd
 
Old 06-03-2014, 11:20 AM   #4
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
What are the permissions for the following directories?

/usr
/usr/local
/usr/local/bin

They should all be set to: drwxr-xr-x
 
Old 06-03-2014, 12:10 PM   #5
tuscani
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
drwxr-xr-x. 13 root root 4096 May 7 2012 usr
drwxr-xr-x. 13 root root 4096 May 7 2012 local
dr-xr-xr-x. 2 root root 36864 Mar 4 13:57 bin
 
Old 06-03-2014, 12:17 PM   #6
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
Change bin to allow root to write.
Create a simple bash script (/usr/local/bin/test.sh) with the same permissions as NEW.pl and try to run that as your unprivileged user.

Sample script:
#!/bin/bash
echo "Hello World!"

I am not sure if the permission to execute has to do with NEW.pl or what NEW.pl is calling and trying to do.
Also, you will not be able to edit the file as any user other than root based on existing permissions.
 
Old 06-03-2014, 12:20 PM   #7
tuscani
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Ok.. that makes sense.. no one has ever used this server as a user other than root. With that said.. I don't want the appsupport user the have write.. just read. It seems even to see the file write perms is needed
 
Old 06-03-2014, 12:23 PM   #8
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by tuscani View Post
useradd -g appsupport appsupport
passwd appsupport
chgrp appsupport /usr/local/bin
chmod go+rx -R /usr/local/bin

I can SSH into the server but when I try and open a file with vi I get "Permission Denied".

Permissions on the file are which resides in bin are:

-rwx------ 1 root root 3070 Jul 26 2012 NEW.pl
Look, you invoked chmod on /usr/local/bin recursively to set read and execute permission on all files/directories residing inside bin. But as you can see, neither read nor execute permission is set for group and other on file NEW.pl. So first, make sure that NEW.pl is located inside /usr/local/bin. And second, if not necessary, then do not change the permission of whole directory, but only change the permission of a single file of your use i.e. NEW.pl only. Just invoke:
Code:
$~ chown appsupport /path/to/NEW.pl
$~ chmod u+rwx /path/to/NEW.pl
Then try to execute the file again.

Last edited by shivaa; 06-03-2014 at 12:25 PM.
 
Old 06-03-2014, 12:47 PM   #9
tuscani
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
The NEW file is in the bin dir..

drwxrwxrwx. 4 root appsupport 4096 Jun 3 11:58 bin

-rwx---rwx 1 root root 3070 Jul 26 2012 NEW.pl
 
Old 06-04-2014, 03:46 AM   #10
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by tuscani View Post
-rwx---rwx 1 root root 3070 Jul 26 2012 NEW.pl
Then change it's group and owner as follow:
Code:
~$ chown appsupport:appsupport NEW.pl
So it will add appsupport i.e. you as owner of the file and appsupport as main group of the file. And after that change it's permissions as:
Code:
~$ chmod 750 NEW.pl
It will grand appsupport i.e. you full permissions and read+execute to group members.
 
  


Reply



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
Booting Centos 5.4 Issue: "CentOS CD Not found in any of the media drives. Please i g.navink Red Hat 1 04-07-2010 04:12 PM
Unifying permissions between two servers (CentOS + Webmin/CentOs +Cpanel) and rsync d60eba Linux - Server 1 01-01-2010 12:55 PM
permissions issue with Samba and CentOS 5.2 hotrock3 Linux - Networking 4 01-10-2009 08:59 PM
repost - Apache 2.2.3 on Centos 5 (RHEL5) permissions issue djjoshuad Red Hat 2 04-19-2007 04:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:52 AM.

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