I cannot access the /etc files while logged in as root

  • yodaman36
  • Born
  • Born
  • No Avatar
  • Joined: Apr 30, 2005
  • Posts: 3
  • Status: Offline

Post April 30th, 2005, 8:00 pm

I am new to Linux (3 days) so I may just not know what I am doing. While su'd to root, or logged in as root, I cannot access the /etc/passwd files, the /etc/group files, or any other files in the /etc directory for that matter. When I try, I get "permission denied". I had always thought that root had access to everything...HELP!!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 30th, 2005, 8:00 pm

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post May 1st, 2005, 7:37 am

It does; are you sure you successfully su'd to root?

Type, whoami at the prompt, what does it say?

Sometimes distributions have various means and methodologies to make changes to those files, but that still should not disable the root user from pretty much doing anything on the system.

If you cannot read a file as root, chances are you are not really root.

Are you certain you were not using sudo?
"It's always a long day, 86,400 won't fit into a short."
  • yodaman36
  • Born
  • Born
  • No Avatar
  • Joined: Apr 30, 2005
  • Posts: 3
  • Status: Offline

Post May 1st, 2005, 8:26 pm

I did the whoami and I am root. I copied and pasted the exact text from terminal below:

[yodaman36@localhost yodaman36]$ su root
Password:
[root@localhost yodaman36]# whoami
root
[root@localhost yodaman36]# /etc/passwd
bash: /etc/passwd: Permission denied
[root@localhost yodaman36]#

Thanks for your help...is there anything else that I am doing wrong?
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post May 2nd, 2005, 4:47 am

Oh my.

You are trying to execute /etc/password. Of course you can't do that. :)

If you want to edit it do,
vi /etc/password

if you just want to look at it,

more /etc/password or
view /etc/password or
less /etc/password

If you are not sure how to use vi I would man vi first to read the man pages.
"It's always a long day, 86,400 won't fit into a short."
  • desertland
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 28, 2005
  • Posts: 206
  • Status: Offline

Post May 2nd, 2005, 7:16 am

"vi" probably isn't the best way for a beginner to edit a file. Try "pico" (pico /etc/passwd). It's more intuitive, but at some point you'll likely want to learn how to use vi. It's far more poweful, and once you figure it out, easier to use.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post May 2nd, 2005, 8:18 am

Pico is not loaded on every system by default; only if pine is installed, usually.

It's best to go ahead and learn the one editor that comes standard on every *nix. Frankly, if someone has root access on a machine where important data will be manipulated -- such as password files -- I would think learning vi a trivial precursor.
"It's always a long day, 86,400 won't fit into a short."
  • aeon
  • Graduate
  • Graduate
  • User avatar
  • Joined: Oct 31, 2004
  • Posts: 184
  • Loc: Ireland
  • Status: Offline

Post May 3rd, 2005, 4:34 pm

Quote:
It's best to go ahead and learn the one editor that comes standard on every *nix. Frankly


I think gentoo is the one exception to that. (that I know of anyway)
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post May 3rd, 2005, 5:56 pm

Uh, Negative.

I said "comes standard" -- not "is the default editor".

Nano, while default for Gentoo, is but one of the editors standard with the installation. VI is most certainly included; no *nix on the planet would be without it, for fear of being scoffed by the old timers.

Here's Gentoo's 'vi help page';
http://www.gentoo.org/doc/en/vi-guide.xml

Cheers.
"It's always a long day, 86,400 won't fit into a short."
  • aeon
  • Graduate
  • Graduate
  • User avatar
  • Joined: Oct 31, 2004
  • Posts: 184
  • Loc: Ireland
  • Status: Offline

Post May 5th, 2005, 11:54 am

Vi is on the live cd, but I distinctly remember having to emerge vi after the install, I've mentioned this to a few other people and they've said the same thing, and at least one of them still doesn't have vi.

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 42 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.