LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Permission denied on " ls "for root user (https://www.linuxquestions.org/questions/linux-general-1/permission-denied-on-ls-for-root-user-37801/)

itsjvivek 12-09-2002 09:45 PM

Permission denied on " ls "for root user
 
Dear,
i am getting permission denied for some files within my home directory using "ls" command.
Even, when the root(super-user) login is used for the same listing , i am getting a permission denied error message.
can anybody help me in explaining/tracing the above message.
as per my knowledge, the super-user can list all the files in any directory.

early response will be appreciated..

Regards
Vivek J.

shelby 12-09-2002 10:44 PM

Instead of su, try "su -" this seems to work better for me. Thansk

itsjvivek 12-09-2002 11:07 PM

does "su - " affect listing of files for super-user.

shelby 12-09-2002 11:16 PM

I believe that su give you super user privleges and su - makes you the user root. Clear as mud?

unSpawn 12-10-2002 02:38 AM

try this (w/o quotes): "strace ls <options> <dir or file>" and post the output here.

Ciccio 12-10-2002 08:20 AM

Quote:

Originally posted by shelby
I believe that su give you super user privleges and su - makes you the user root. Clear as mud?
NO! su is a command that Switches User. you actually become root when you run su, when you run su - all you do is change to root and go to the home path for root (usually /root). you can use the command su for changint to ANY user for example, you are the user john and want to change to user smith, you use the command $su - smith and if then you want to become root you run $su -

PLEASE READ man su !!!

moses 12-10-2002 04:44 PM

Reread the man page.
Code:

su [username]
just gives you the permissions of the username, without the environment
of that username. No username => switch user to root (uid 0, really)
Code:

su - [username]
sets up the environment of the user you have switched to. It matters,
because if you are "frodo" and you "su bilbo", you keep frodo's
environment, which means if bilbo has a different path from frodo, you
won't get what you expect for bilbo. However, if you use "su - bilbo", you
will get the environment of bilbo.
It doesn't matter that much for this question, since
Code:

su
should give the permissions necessary to read almost any files.
How is the home disk/partition mounted? If it's mounted via NFS, root
most likely WON'T have permission to read the files, since that
permission is set by the server. If the disk is local but mounted in a funky
way, you could cause all files, but not just certain files to be unreadable.

Ciccio 12-10-2002 08:15 PM

anyway, If you don't use su - you wont be able to run a lot of command (since you don't have the env you dont have the path)

itsjvivek 12-10-2002 11:49 PM

Output of strace command
 
here is an output of strace command :

orbit@avior:~/data> strace ls -l secrvr.log

Meatwad 12-11-2002 12:22 AM

Do you have read and execute privelleges to the directory in which you're trying to look in?

Ciccio 12-11-2002 02:13 PM

have you red the man pages of strace and ls???

shelby 12-11-2002 06:51 PM

I "red" the man pages and it blue...sorry I could not resist :D

Ciccio 12-11-2002 07:02 PM

oooooooooops, didn't see that.
 
Quote:

Originally posted by shelby
I "red" the man pages and it blue...sorry I could not resist :D
No problem.


All times are GMT -5. The time now is 10:04 AM.