Console Commands (Solved)

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: Console Commands

Post by MALsPa »

Cheemag wrote: Who says you can't be root with a persistent live session on a key? o)

Code: Select all

 ________________________________________
( Celebrate Hannibal Day this year. Take )
( an elephant to lunch.                  )
 ----------------------------------------
  o
   o
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_) 
  
mint mint # whoami
root
mint mint # ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

mint mint # cd /
mint / # ls
bin   cdrom  etc   initrd.img  media  opt   rofs  sbin     srv  tmp  var
boot  dev    home  lib         mnt    proc  root  selinux  sys  usr  vmlinuz
mint / #
 
Done by generating a root console launcher with gnome-terminal -e 'sudo - su'
Whether I can actually DO anything remains to be be seen - best not mess around
in root.
You might want to check out the RootSudo page at the Ubuntu Documentation, if you haven't already.

https://help.ubuntu.com/community/RootSudo

Including the area "Special notes on sudo and shells."

There I found a link to this table, which might (or might not) explain some things:

Code: Select all

Here is a summary:
Code:

				                     corrupted by user's 
		HOME=/root	uses root's PATH     env vars
sudo -i		Y		Y[2]                 N
sudo -s		N		Y[2]                 Y
sudo bash	N		Y[2]                 Y
sudo su		Y		N[1]                 Y


[1] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    probably set by /etc/environment
[2] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

The bottom line, is "sudo -i" is the proper command to run when you want a root shell that is untainted by the user's environment.
When I was trying to recreate what you were seeing, to get a root prompt I simply opened a terminal and used the following:

Code: Select all

sudo -i
You used a launcher with:

Code: Select all

gnome-terminal -e 'sudo - su'
According to the table above, it could make a difference in the results of your commands.

I really prefer to stick with the recommendations in Ubuntu's RootSudo documentation and simply use sudo or gksudo when I need root access, but I guess there's no reason you can't use one of those other commands to get yourself a root prompt.
gn2

Re: Console Commands

Post by gn2 »

Cheemag wrote:Who says you can't be root with a persistent live session on a key?
I've no idea who would say that, I know it wasn't me.
Cheemag

Re: Console Commands

Post by Cheemag »

MALsPa wrote:
Cheemag wrote: Who says you can't be root with a persistent live session on a key? o)

You might want to check out the RootSudo page at the Ubuntu Documentation, if you haven't already.

https://help.ubuntu.com/community/RootSudo

Including the area "Special notes on sudo and shells."

There I found a link to this table, which might (or might not) explain some things:

Code: Select all

Here is a summary:
Code:

				                     corrupted by user's 
		HOME=/root	uses root's PATH     env vars
sudo -i		Y		Y[2]                 N
sudo -s		N		Y[2]                 Y
sudo bash	N		Y[2]                 Y
sudo su		Y		N[1]                 Y


[1] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    probably set by /etc/environment
[2] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

The bottom line, is "sudo -i" is the proper command to run when you want a root shell that is untainted by the user's environment.
When I was trying to recreate what you were seeing, to get a root prompt I simply opened a terminal and used the following:

Code: Select all

sudo -i
You used a launcher with:

Code: Select all

gnome-terminal -e 'sudo - su'
According to the table above, it could make a difference in the results of your commands.

I really prefer to stick with the recommendations in Ubuntu's RootSudo documentation and simply use sudo or gksudo when I need root access, but I guess there's no reason you can't use one of those other commands to get yourself a root prompt.
The only reason for everything that's been happening is that, as a user of Mint on a
key drive, there is no way you can become root as you are running a live session and
not a full install.

Using the custom launcher works sometimes, but you can't actually do anything
root-like.

The system on a key drive with persistence is like that on a live-CD with the exception that
it saves your settings on closing. I have EMailed Pendrive Linux and they confirm this is the case.
I did not realise this and thought that I had an installed system.

For me it's a matter now of deciding whether to continue this way or to seek some other
method of doing a full install.

Thank you for your interest.
Cheemag

Re: Console Commands (Solved - sort of)

Post by Cheemag »

Cheemag wrote:What am I to make of this nonsense:

Code: Select all

mint ~ # cd /
bash: cd /: No such file or directory
mint ~ # cd usr/bin
bash: cd usr/bin: No such file or directory
mint ~ # 
I know damn well that there is such a directory as /usr/bin !  Why can't I cd to it?

Also:  very often I issue a command without parameters, to be told to goto  <command> --help ... On doing so, I'm there's no
such command!!!!

Confused!
Locked

Return to “Beginner Questions”