Re: How to use sudo to get a root shell?

Joe S <[email protected]>
Newsgroups gmane.org.user-groups.linux.calgary.general
Message-ID <20150318233540.52e879ce@crunchbang>
I am trying to get a vpn setup. I thought logging in with su - might
have been a problem. When I run the following command with a root
terminal it is looking in my home directory:
root@crunchbang:/etc/openvpn/vpn_book# lsof|grep openvpn
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file
system /home/joe/.gvfs


On Tue, 17 Mar 2015 12:05:33 -0600
Gustin Johnson <[email protected]> wrote:

> That error you posted can actually be ignored.  Generally
> stackexchange has high quality answers.
> 
> http://unix.stackexchange.com/questions/171519/lsof-warning-cant-stat-fuse-gvfsd-fuse-file-system
> 
> As for the "right" way, both of the options you listed will work
> pretty much as expected.   sudo -i allows customization in
> the /etc/sudoers file, while the "su -" variant simply loads the
> system environment.  Out of the box they should be the same.  On
> multi-user systems I actually prevent "sudo su -" from working, and
> define lists of applications that certain users/groups can use sudo
> for.  Both sudo -i and su are extremely dangerous.
> 
> Generally I avoid running a shell as root, so I tend to just use sudo
> <command>, and sudoedit <restricted file>.  This has the advantage of
> an audit trail, so if I screw up I can usually figure out how and
> where.
> 
> On Tue, Mar 17, 2015 at 11:53 AM, Gustin Johnson <[email protected]>
> wrote:
> 
> > Why not just use sudo to run lsof?
> >
> > sudo lsof |grep openvpn
> >
> > If you are looking for listening ports, then:
> > sudo lsof -i |grep openvpn
> >
> >
> >
> > On Tue, Mar 17, 2015 at 11:39 AM, Joe S <[email protected]> wrote:
> >
> >> I am wondering if someone can tell me the right way to get a root
> >> shell through sudo. I tried the following commands:
> >> sudo su -
> >> sudo -i
> >>
> >> Then tried the following command and got this warning:
> >>
> >> lsof|grep openvpn
> >> lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file
> >> system /home/joe/.gvfs Output information may be incomplete.
> >>
> >> It looks like Linux is looking in the wrong directory for info. I
> >> have read that the correct way to do this was sudo su -
> >> This would use root's environment and home directory.
> >>
> >> Looking on the Net is confusing as I get conflicting advice between
> >> this.
> >>
> >> Thanks
> >>
> >> _______________________________________________
> >> clug-talk mailing list
> >> [email protected]
> >> http://clug.ca/mailman/listinfo/clug-talk_clug.ca
> >> Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
> >> **Please remove these lines when replying
> >>
> >
> >


_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.