FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 09-29-2011, 11:59 AM
Paul Sladen
 
Default How to use sudo to view a hidden directory?

On Wed, 28 Sep 2011, Knute Johnson wrote:
> But since you responded, how would you change directories to one that
> you can't read with your user privilege

$ man sudo | grep -A3 -B1 'sub-shell'

To make a usage listing of the directories in the /home partition.
Note that this runs the commands in a sub-shell to make the cd and file
redirection work.

$ sudo sh -c "cd /home ; du -s * │ sort -rn > USAGE"

But it's very rare in practice (in my workflows) that I'd need to do
this; mostly a:

sudo ls -l /root
sudo cp -a /root/hidden /root/other-hidden

is sufficient. If you need to cat into a root owned file, you can:

echo asdf | grep asdf | sudo tee -a /root/created-as-root

all of these have the massive advantage of being logged and audited.

-Paul


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 09-29-2011, 09:57 PM
Avi Greenbury
 
Default How to use sudo to view a hidden directory?

Paul Sladen wrote:
> But it's very rare in practice (in my workflows) that I'd need to do
> this; mostly a:
>
> sudo ls -l /root
> sudo cp -a /root/hidden /root/other-hidden
>
> is sufficient. If you need to cat into a root owned file, you can:
>
> echo asdf | grep asdf | sudo tee -a /root/created-as-root
>
> all of these have the massive advantage of being logged and audited.

I was under the impression that the shell started by

sudo -s

was similarly logged, is that not so? If so, that's substantially more
humane (in my opinion) than adding five keystrokes to each command.

--
Avi

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 09-29-2011, 11:06 PM
Knute Johnson
 
Default How to use sudo to view a hidden directory?

On 9/29/2011 2:57 PM, Avi Greenbury wrote:

Paul Sladen wrote:

But it's very rare in practice (in my workflows) that I'd need to do
this; mostly a:

sudo ls -l /root
sudo cp -a /root/hidden /root/other-hidden

is sufficient. If you need to cat into a root owned file, you can:

echo asdf | grep asdf | sudo tee -a /root/created-as-root

all of these have the massive advantage of being logged and audited.


I was under the impression that the shell started by

sudo -s

was similarly logged, is that not so? If so, that's substantially more
humane (in my opinion) than adding five keystrokes to each command.



sudo -s cd /root works but you don't stay there once the shell is done.
sudo -s cd /root; ls works fine though, thanks for that tip.


Doesn't seem to log the commands though.

--

Knute Johnson

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 05:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org