I opened a second tab in konsole and immediately ran sudo su to obtain a prompt as root. I ran a program and then I forgot to exit and just closed the tab. Am I still root somewhere? Or did closing the tab do the same thing as a proper exit?
On Sat, 27 May 2017 19:09:59 -0600 Peter Gueckel pgueckel@gmail.com wrote:
I opened a second tab in konsole and immediately ran sudo su to obtain a prompt as root. I ran a program and then I forgot to exit and just closed the tab. Am I still root somewhere? Or did closing the tab do the same thing as a proper exit?
It's my understanding that when the terminal closes, all associated processes are automatically stopped, unless something like screen was used to start a background job. I'm not sure if it is the same exit as a proper logout; e.g. does it save shell history?.
On 05/27/2017 06:09 PM, Peter Gueckel wrote:
I opened a second tab in konsole and immediately ran sudo su to obtain a prompt as root. I ran a program and then I forgot to exit and just closed the tab. Am I still root somewhere? Or did closing the tab do the same thing as a proper exit?
First, running sudo su is redundant if you know the root password, as I presume you do. (It's your system, you installed it and assigned the root password.) In fact, the only reason to use sudo at all is if you don't know the root password, or you're running a distro that doesn't normally have a root password.
That being said, closing a tab, or the terminal program exits any and all programs that were active, including the shell, and logs you out, so there's no root session floating around in the void to worry about.
On Sat, 27 May 2017 18:48:06 -0700 Joe Zeff wrote:
First, running sudo su is redundant if you know the root password, as I presume you do. (It's your system, you installed it and assigned the root password.) In fact, the only reason to use sudo at all is if you don't know the root password, or you're running a distro that doesn't normally have a root password.
Nope, completely myth, and here's why: "sudo su -l" is absolutely the fastest and most efficient way to get a root login shell where the PATH is set correctly to find the programs that root needs to be able to run (at least it is the fastest way if your user is setup to not require a password for sudo :-).
On 05/27/2017 07:05 PM, Tom Horsley wrote:
On Sat, 27 May 2017 18:48:06 -0700 Joe Zeff wrote:
First, running sudo su is redundant if you know the root password, as I presume you do. (It's your system, you installed it and assigned the root password.) In fact, the only reason to use sudo at all is if you don't know the root password, or you're running a distro that doesn't normally have a root password.
Nope, completely myth, and here's why: "sudo su -l" is absolutely the fastest and most efficient way to get a root login shell where the PATH is set correctly to find the programs that root needs to be able to run (at least it is the fastest way if your user is setup to not require a password for sudo :-).
I always use "sudo -s" and I've never had a problem with paths.
OK, thanks, guys. I was just curious.
Yes, I do have my system set up not to require the password for sudo. It is faster than constantly having to type it, time and again. System installation is hell without it ;-)
Now, I wonder about $PATH: what is the correct value "to find the programs that root needs"?
you could run "who" to see if the root user is still logged on as well.
On Sat, May 27, 2017 at 11:36 PM, Peter Gueckel pgueckel@gmail.com wrote:
OK, thanks, guys. I was just curious.
Yes, I do have my system set up not to require the password for sudo. It is faster than constantly having to type it, time and again. System installation is hell without it ;-)
Now, I wonder about $PATH: what is the correct value "to find the programs that root needs"? _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org
Joe Zeff wrote:
On 05/27/2017 10:12 PM, fred roller wrote:
you could run "who" to see if the root user is still logged
on as well.
I have a terminal open, logged in as root with su -. When I
ran who, it
just showed me, logged in once and no root. Checking with
uptime, it
shows one user.
I never heard of 'who' ;-) Unfortunately, it is true: I ran 'su -' and then who in another tab and in a different terminal emulator and it showed no root nor me as root, just me.
On 27May2017 21:36, Peter Gueckel pgueckel@gmail.com wrote:
OK, thanks, guys. I was just curious.
Well, closing a terminal emulator should normally sent SIGHUP to processes still on the terminal. Which may or may not exit (most will). And then there's job control and "disown"ed jobs (things you've asked to continue running by no longer being managed by the shell).
[...]
Now, I wonder about $PATH: what is the correct value "to find the programs that root needs"?
In the sense used earlier, "what root gets as a login shell" i.e. when root's profile gets run. This the "su -l" etc. My preferred incantation is "su -" myself.
But nothing prevents you just adding /sbin and /usr/sbin etc to your own path; plenty of "administrative" commands make perfect sense to run as yourself in reporting mode. "ifconfig" is the one I notice missing most.
Get a root login shell. Inspect the $PATH. Update your own as you see fit.
Cheers, Cameron Simpson cs@zip.com.au
On Sat, 27 May 2017 21:36:29 -0600 Peter Gueckel wrote:
Now, I wonder about $PATH: what is the correct value "to find the programs that root needs"?
Well, root tends to have /sbin which "normal" users don't have by default. There may be others, also there can be aliases and such in root's .bash_profile which won't show up without a login shell.
On 28 May 2017 at 15:16, Tom Horsley horsley1953@gmail.com wrote:
On Sat, 27 May 2017 21:36:29 -0600 Peter Gueckel wrote:
Now, I wonder about $PATH: what is the correct value "to find the programs that root needs"?
Well, root tends to have /sbin which "normal" users don't have by default.
That's not true any more; Nowadays normal users have /usr/sbin/ in their path, and /sbin/ is a symlink to /usr/sbin...
Tom Horsley wrote:
On Sat, 27 May 2017 21:36:29 -0600 Peter Gueckel wrote:
Now, I wonder about $PATH: what is the correct value "to
find the
programs that root needs"?
Well, root tends to have /sbin which "normal" users don't have by default. There may be others, also there can be aliases and such in root's .bash_profile which won't show up without a login shell.
OK, thanks. I just checked and /usr/sbin is in the PATH for both root and users by default. The only change I made there is to add ./local/bin for users (me).
On Sat, May 27, 2017 at 10:05 PM, Tom Horsley horsley1953@gmail.com wrote:
Nope, completely myth, and here's why: "sudo su -l" is absolutely the fastest and most efficient way to get a root login shell where the PATH is set correctly
"-i" is faster than "su -l" :)
On 05/28/2017 01:04 AM, Tom H wrote:
On Sat, May 27, 2017 at 10:05 PM, Tom Horsley horsley1953@gmail.com wrote:
Nope, completely myth, and here's why: "sudo su -l" is absolutely the fastest and most efficient way to get a root login shell where the PATH is set correctly
"-i" is faster than "su -l" :)
Hey, I learned something new! The thing that has always annoyed me about "sudo -s" is that it leaves me in the current directory instead of going to /root. "sudo -i" solves that.
On 05/27/2017 10:12 PM, fred roller wrote:
you could run "who" to see if the root user is still logged
on as well.
I have a terminal open, logged in as root with su -. When I
ran who, it
just showed me, logged in once and no root. Checking with
uptime, it
shows one user.
I never heard of 'who' ;-) Unfortunately, it is true: I ran 'su -' and then who in another tab and in a different terminal emulator and it showed no root nor me as root, just me.
True, you will see the multiple instances of your log-in and their "terminal". "tty" for your graphics and "pts" for terminal emulators. Open multiple tabs in your cli emulator and run who and you will what I am talking about. Running sudo invokes root privileges for your user, hence, no root user just your user. You would have to set root pw and actually log-in with root to see the root log in. I apologies for the ambiguity.
-- Fred
On 05/29/2017 12:17 PM, fred roller wrote:
On 05/27/2017 10:12 PM, fred roller wrote:
you could run "who" to see if the root user is still logged
on as well.
I have a terminal open, logged in as root with su -. When I
ran who, it
just showed me, logged in once and no root. Checking with
uptime, it
shows one user.
I never heard of 'who' ;-) Unfortunately, it is true: I ran 'su -' and then who in another tab and in a different terminal emulator and it showed no root nor me as root, just me.
True, you will see the multiple instances of your log-in and their "terminal". "tty" for your graphics and "pts" for terminal emulators. Open multiple tabs in your cli emulator and run who and you will what I am talking about. Running sudo invokes root privileges for your user, hence, no root user just your user. You would have to set root pw and actually log-in with root to see the root log in. I apologies for the ambiguity.
"who" shows you who is currently logged in (based on data from /var/run/utmp or /var/log/wtmp). Since the other "su -" sessions were spawned from the initial user's shell, "who" only shows that initial login user since that's the only user who actually logged in and has data in utmp or wtmp. Remember that "su -" or "sudo -i" do NOT actually perform logins--they fork a process and run the shell in that process handing it flags that make it ACT like a login shell.
If you do a "ps flax" and track things, you'll see that the bash sessions with the UID of root all have parent processes that are "su -" programs, which were in turn run by the initial logged-in user. You'll also find their process names are "-bash" and not "bash". ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 - - - - We look for things. Things that make us go! - - -- The "Paclyds", Star Trek TNG - ----------------------------------------------------------------------