LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-17-2012, 04:24 PM   #1
ltoni
LQ Newbie
 
Registered: Oct 2011
Location: Fort Worth Texas
Distribution: ubuntu, Red Hat, Fedora
Posts: 2

Rep: Reputation: Disabled
Permission denied as root for /etc/passwd


1. Signed in as root in RHEL 5 at the prompt [root@localhost ~]# and when I input the command, "/etc/passwd" the output is, bash: /etc/passwd: permission denied.

2. Next I tried to view the permissions of the file with "ls -l /etc/passwd". the output is, "-rw-r--r-- 1 root root 1980 Apr 17 15:16 /etc/passwd

It seems I have read and wite permissions for the file, and groups and users have read only.

What is you advice or suggestions?

Thanks in advance to all for your help.

Last edited by ltoni; 04-17-2012 at 04:27 PM. Reason: clear up a bit
 
Old 04-17-2012, 04:26 PM   #2
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
/etc/passwd is a text file - you cannot execute it, hence the permission denied because it is not a script/program - you need to use a text edit tool like vi or nedit to edit the file

Example:

# vi /etc/passwd

Be careful editing the /etc/passwd file

Last edited by ADxD_7; 04-17-2012 at 04:27 PM.
 
1 members found this post helpful.
Old 04-17-2012, 04:49 PM   #3
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
Are you trying to change a password?
In that case you want /usr/bin/passwd not /etc/passwd.
 
1 members found this post helpful.
Old 04-17-2012, 05:43 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Also, if your intention is to simply view /etc/passwd, then use the less(1) pager.

Code:
$ less /etc/passwd
(Note that you don't need to be root to view it, BTW.)
 
Old 04-17-2012, 06:01 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,349

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
In fact, you should really use useradd/usermod/userdel tools rather than edit it directly.
http://linux.die.net/man/8/useradd http://linux.die.net/man/8/usermod http://linux.die.net/man/8/userdel
 
Old 04-18-2012, 11:38 AM   #6
ltoni
LQ Newbie
 
Registered: Oct 2011
Location: Fort Worth Texas
Distribution: ubuntu, Red Hat, Fedora
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for all your responses I'm still learning about he power and limits of root.
I was only trying to view /etc/passwd, and will use the command "less /etc/passwd".
Thanks again.

Last edited by ltoni; 04-18-2012 at 11:41 AM.
 
Old 04-18-2012, 12:30 PM   #7
kyrunner
LQ Newbie
 
Registered: Apr 2012
Location: New York
Distribution: Centos,Debian
Posts: 29

Rep: Reputation: 1
cat /etc/passwd
 
  


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
su root permission denied stardotstar Linux - Software 6 08-20-2006 08:24 PM
permission denied when root? TaNeK Linux - Software 8 02-01-2005 12:39 PM
Permission denied as root Cynric Linux - General 4 08-15-2004 11:47 AM
su root permission denied exodist Linux - Software 4 07-23-2004 03:34 PM
Even as root, Permission Denied RevX Linux - Software 7 04-24-2004 11:10 PM

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

All times are GMT -5. The time now is 06:02 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