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

  • yodaman36
  • Born
  • Born
  • yodaman36
  • Posts: 3

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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?
  • yodaman36
  • Born
  • Born
  • yodaman36
  • Posts: 3

Post 3+ Months Ago

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
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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.
  • desertland
  • Graduate
  • Graduate
  • desertland
  • Posts: 206

Post 3+ Months Ago

"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
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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.
  • aeon
  • Graduate
  • Graduate
  • User avatar
  • Posts: 184
  • Loc: Ireland

Post 3+ Months Ago

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
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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.
  • aeon
  • Graduate
  • Graduate
  • User avatar
  • Posts: 184
  • Loc: Ireland

Post 3+ Months Ago

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 56 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.