PDA

View Full Version : [SOLVED] sudo view all files



whizzle
September 29th, 2009, 07:46 PM
Hi ya gang, first post here! :)

I log in as a user and then I want to sudo as root so I can view ALL users on the system. For example, when I type ls /home. I'd expect to see ALL user's home directory and not just mine when I sudo. But sadly I can only see mine. Can anyone give me some pointers?

Cheers
\w/

sloggerkhan
September 29th, 2009, 07:47 PM
Maybe you're the only user?
OTB you don't even need root perms to ls /home/

whizzle
September 29th, 2009, 07:51 PM
Oh no...I'm positive I'm not the only user. If I login as root I can see many users. I just can't see them when I sudo.

Darkwing-Duck
September 29th, 2009, 07:53 PM
If you want to view *all* files in a folder to include hidden ones you can use this flag on the ls command.


ls -a

For a list of flags that can be added you can type.


ls --help

Hope this helps you out a bit.

EDIT: Here is a good online list of what each thing does with the ls command.

http://www.computerhope.com/unix/uls.htm

slakkie
September 29th, 2009, 08:02 PM
sudo find /home -type f -exec less {} +

that is to see the contents of all files.
Remove the '-exec less {} +' if you only want to see what files are present.

Best of luck.

whizzle
September 29th, 2009, 08:05 PM
nah....still not giving me what I need. Here's the scenario.

There are 2 user's on the sytem: whizzle and fudcake. whizzle can sudo fudcake can't.
whizzle logs into the system and sudo's.
whizzle tries to change directory to /home/fudcake
system gives an error saying "No such file or directory"
root logs into the system and types /home/fudcake everything is fine.

How can whizzle login and sudo and get to fudcake without having to manually login as user root?
make sense? thanks guys :)

bwallum
September 29th, 2009, 08:12 PM
how about
gksudo nautilus

hotstovejer
September 29th, 2009, 08:14 PM
Check and see if whizzle is a member of the admin group. Also, file permissions on the folder might be restrictive. Unprivlidged users can hardly see anything.

lswb
September 29th, 2009, 08:17 PM
I think "sudo -i", which will open a root shell, is what you want.

whizzle
September 29th, 2009, 08:21 PM
Check and see if whizzle is a member of the admin group. Also, file permissions on the folder might be restrictive. Unprivlidged users can hardly see anything.

hmm....how do I see if whizzle is a member of the admin group? whizzle is in the sudoers file with privileges of ALL just like root.

as for gksudo...yea I think that would give me everything I need....however, i also kind of need a solution for my webserver online which is a distro of red hat without any GUI on in. But yeah, when on my home box gksudo gives me everything I need. :)

slakkie
September 29th, 2009, 10:21 PM
I'm convinced that sudo find command should give you what you need...

If it is not working, could you paste the output of the command?

sloggerkhan
September 29th, 2009, 11:35 PM
it sounds like your permissions aren't default.

A_Fiachra
September 29th, 2009, 11:59 PM
sudo cat /etc/sudoers



You probably don't have sufficient permissions to sudo everything. Which makes sense almost all of the time except when you own the machine.

whizzle
September 30th, 2009, 02:12 AM
I'm convinced that sudo find command should give you what you need...
If it is not working, could you paste the output of the command?
sure


joshm@----.com [~]# sudo ls /home/joshuamu
Password:
ls: /home/joshuamu: No such file or directory
joshm@-----.com [~]#
visudo


joshm ALL=(ALL) PASSWD:ALL

cranecreek
September 30th, 2009, 02:26 AM
Do what lswb (http://ubuntuforums.org/member.php?u=210286) said:


sudo -iThat will make you root then you can do as you wish

whizzle
September 30th, 2009, 02:59 AM
i've been wanting to avoid that as I've read it isn't a preferred thing to do so....If it's the only option so be it.

i do appreciate the help so far guys! Today is around my 4th day of running Linux (Ubuntu) and I don't see myself switching back to M$ anytime soon...only for stuff linux doesn't have like Adobe CS products. Cheers :)

Miljet
September 30th, 2009, 03:08 AM
.however, i also kind of need a solution for my webserver online which is a distro of red hat without any GUI on in

Perhaps the above quote offers the answer. It is my understanding that sudo only works for Ubuntu, and derivatives.

sloggerkhan
September 30th, 2009, 03:44 AM
Perhaps the above quote offers the answer. It is my understanding that sudo only works for Ubuntu, and derivatives.

Sudo can be set up to work on other distros. However, it is not OTB configured on most red hat set ups.

whizzle
September 30th, 2009, 07:33 AM
ok...all the solutions here work great for my Ubuntu set up. Thanks guys! And here is a quote from my web host, it doesn't look like something I'll pursue too much....sigh.

Since multiple users will need permissions to multiple directories, the best way would be to create a group and add the users to the group. However, we'll still need to change the group-ownership and group permissions on every file and directory you'd like them to have access to. Depending on your Apache setup, this might interfere with running your domain's software- particularly PHP scripts

starcannon
September 30th, 2009, 07:46 AM
When adding a new user using the:
System>Administration>Users and Groups
widget, the default is to make all new users Desktop Users. The easiest solution is, to log in with the current sudo capable Administrator account, open up the Users and Groups application, unlock the application, select the user that needs Administrator privileges, click on Properties, click on the User Privileges tab, tick all the boxes, click Okay, close the Users and Groups window, Log out, Log into the user you just escalated permissions for, and sudo should now be working.

GL and HF

slakkie
September 30th, 2009, 08:26 AM
sure


joshm@----.com [~]# sudo ls /home/joshuamu
Password:
ls: /home/joshuamu: No such file or directory
joshm@-----.com [~]#
visudo


joshm ALL=(ALL) PASSWD:ALL


Sir, that is not sudo find.

whizzle
October 7th, 2009, 08:55 AM
turns out the user was in a "jailshell." put him in a regular shell and everything is fine now.

cheers