Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Mishap re sumo


  • Please log in to reply
12 replies to this topic

#1 cooljay

cooljay

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:37 AM

Posted 29 May 2017 - 12:02 PM

As some of you know, I installed Lubuntu on my little notebook ("sacrificing my beloved Win XP), with a lot of help and hand-holding by some of you valiant souls...

 

Then, life's distractions, etc. Long story short, I only just got back to it, and I realized I made a really big mistake when I set it up.

 

I am basically ALWAYS the admin. And I know that's bad. From what I understand, you shouldn't ever go online as admin. I didn't realize I had this problem. Every time I install something it asks me for the password. From what I understand, this is only good for 15 minutes, so technically, if I wait that long I can go online not rooted. But who wants to live that way?

 

I should clarify. I didn't split my two personalities (lol, schizo here). It doesn't give the option btw admin and myname. It's always my name. It's entirely my fault, I was panicky when I first booted things up and rushing when I really should have stopped and thought for a moment what I was doing.

 

So my question is now, how do I split these two so that I can always go back and forth as needed?

 



BC AdBot (Login to Remove)

 


#2 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:03:37 AM

Posted 30 May 2017 - 03:03 AM

"sumo" or "sudo"?  If sudo, that means "do as super user" and the 15 minute timeout  exists for that terminal window or application only and only applies to commands that need elevated privs.

If you did the following sequence all within the 15 minute window:

 

sudo mount -t vfat /dev/sda1 /mnt

firefox &

sudo umount /mnt

 

The mount and umount commands run as superuser, the firefox command runs as you. 

If you do

sudo /bin/bash

 

then every command you run in the bash shell will run as superuser until you type in exit.

 

Boot up the computer, log into it the way you normally do, open a terminal window and type in "whoami".  If it does NOT say root, then you are logged in as a normal user, not admin. 

Then you can take that info and see what default privileges you have:

grep `whoami` /etc/passwd    (those are "backticks" around the whoami, should be on the key left of the number 1, unshifted under the tilde).

then

grep `whoami` /etc/group    that tells you what groups you are in.  If you are not in wheel, root, operator then your username/group is not privileged.

 

Don't worry about fault, slow down and think, ask questions.

 

Some folks will create a user with very limited privileges to use when going online:  6s and 3s if you really need to.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#3 Al1000

Al1000

  • Global Moderator
  • 8,118 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:37 AM

Posted 30 May 2017 - 07:50 AM

In Ubuntu and its derivatives, the root (equivalent of admin in Windows) account is disabled by default. Because of this, sudo is also installed by default, and your username is added to the sudoers file, which is what enables you to perform root level actions by entering your password.

If you were running as root (if the root account was enabled), you wouldn't be using sudo, or be asked for your password when you install something.

Edited by Al1000, 30 May 2017 - 07:51 AM.


#4 cooljay

cooljay
  • Topic Starter

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:37 AM

Posted 30 May 2017 - 09:09 AM

mremski, thank you so much for this.

 

"The mount and umount commands run as superuser, the firefox command runs as you. 

If you do

sudo /bin/bash

 

then every command you run in the bash shell will run as superuser until you type in exit."

 

This is freaking brilliant!

 

 

Al1000, I really want to find that article again. Either I need to read more carefully or he is off his rocker. (Probably the former.) If I remember correctly he's the same guy who says you shouldn't install in root if at all avoidable. He says it can mess things up, creating unnecessary files and whatnot. Sigh. I know

 

I wasted so much time last night trying to create a shared folder that both users can share so that one can download and the other can install. LOL. Well, I'm becoming more familiar, finding my way around. I really like Linux.

 

So just to clarify, there is no admin, or whatever the equivalent is in Ubuntu, is this right? There are only users with different levels of privileges. And myname user that I created 3 months ago - did I overlook something? Or does everybody only have one name user in the beginning, and then they create more? I keep having the feeling I am missing something here.


Edited by cooljay, 30 May 2017 - 09:10 AM.


#5 Al1000

Al1000

  • Global Moderator
  • 8,118 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:37 AM

Posted 30 May 2017 - 09:47 AM

If I remember correctly he's the same guy who says you shouldn't install in root if at all avoidable. He says it can mess things up, creating unnecessary files and whatnot. Sigh. I know


Many applications have configuration files in your user's home directory. To see them listed, open a terminal and run:
ls -a
The above command lists "all" files in a directory, i.e. including hidden files, which begin with .
Note the location of your user's home directory. To find it, open a terminal and type pwd. This command prints your present working directory.

(we use the term "print" because Linux is based on Unix, and Unix commands go back to the days before computer monitors, when the standard output for a computer was a teleprinter).

The home directory for root is /root. Open a terminal with your normal user and try to list the files in the root home directory; you will get a permission denied error:
ls -a /root
Now try this. Open a terminal and run this command:
sudo su
Enter your password at the prompt.
The first thing to notice is that your prompt in the terminal will have changed.
Example:
al@my-desktop-pc:~$ sudo su
[sudo] password for al: 
root@my-desktop-pc:/home/al#
Note that as above, your terminal will tell you that you are running as root, instead of as your normal user which you set up during installation. Now try to list the files in /root, and you will be able to see them. Compare the list of configuration files in the root user's home directory, to the list of configuration files in your normal user's home directory. To insure that the configuration files for applications you would run as a normal user end up in the correct directory, and not in the root user's home directory, is I suspect why the advice you read said to avoid installing things as root.
 

So just to clarify, there is no admin, or whatever the equivalent is in Ubuntu, is this right?


As per above, you can access root, you just can't log in as root using the default settings.

When running as root in a terminal, type exit once to return to running as your normal user, then type exit again to close the terminal.

Edited by Al1000, 30 May 2017 - 09:48 AM.


#6 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:03:37 AM

Posted 30 May 2017 - 09:49 AM

All *nix systems (Linux, *BSD, Solaris, SunOS, AIX, ...) have a user named "root".  When folks talk about "superuser" they mean "root".  Root is the equivalent of Windows "Admin":  simply a user account that has elevated privileges, that can act with great harm or do great good.  Your choice :) Windows Admin is simply a user with more power/privileges than usual.

 

By default a lot of the desktop oriented Linux distributions (Ubuntu, Fedora, Mint, etc) do not show the user "root" at the login screen, so they try to protect you from bad things.  When you log in with your username and need to do a system level task (like download and install updates), you get asked for your password because they system is basically doing a "sudo" for you.

 

When folks install a system, they typically create one user at install time and use that for everyday stuff.  If it's a shared system, they "add another user" (look for a "users and groups" under that applications somewhere), just like on a Windows 7/8/10 multiuser system they "add another user".

 

Adding another user on a single user system is good so you can have a "muck around account" (think of a work account/user and a home user), you can practice different things in it without fear of messing up your primary account.

 

"...installing in root"  Pay attention to context with phrases like this.  "root" is superuser/admin, but "root" is also the base of the filesystem (think C: in Windows).  If you install too many different programs in the root file system, you can run out of space and get the system wedged (just like if you run out of space on C:)  but in order to install the programs you need to be root (or sudo) to install them.  (See what I meant about context? :) )

 

Just keep playing and asking questions: don't overthink things and don't blindly run scripts you find on the Internet.  Worst case is you wind up reinstalling (we all have done that), so get a few USB thumb drives and copy your important data (and configuration)  to it (data is important, programs usually aren't)

 


Edited by mremski, 30 May 2017 - 09:50 AM.

FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#7 cooljay

cooljay
  • Topic Starter

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:37 AM

Posted 30 May 2017 - 10:04 AM

Thanks so much guys. It's a whole new world for me. Very exciting. If I could I would spend all day on this. Eventually I want to install Linux on my main laptop, possibly as a split at first. But I have to become more comfortable first so I know what I am doing.

 

And, I have no intention to install scripts from the internet. No way! I keep to Ubuntu Software Center right now. - By the way, why is there no search panel in the software center? When I chose it from the Edit drop down menu, it never appears. Neither does Ctrl+F do anything. I would really like to search for some items there, but right now I am stuck with the recommendation section.



#8 Al1000

Al1000

  • Global Moderator
  • 8,118 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:37 AM

Posted 30 May 2017 - 10:27 AM

I don't use the Ubuntu Software Centre, but you can also use the terminal to search for applications (in the same Ubuntu repositories that the Software Centre uses).

Supposing you want to search for a game that entails "combat"; open a terminal and run this command:
apt-cache search combat
The first result will be:
astromenace - hardcore 3D space shooter with spaceship upgrade possibilities
For further details, run this command:
apt-cache policy astromenace
Example:
al@my-desktop-pc:~$ apt-cache policy astromenace
astromenace:
  Installed: (none)
  Candidate: 1.3.2+repack-3
  Version table:
     1.3.2+repack-3 0
        500 http://gb.archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages
To install that game using terminal, all you would have to do is run this command:
 sudo apt-get install astromenace
Terminal is lots of fun, if you like that sort of thing. :)

#9 cooljay

cooljay
  • Topic Starter

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:37 AM

Posted 30 May 2017 - 10:38 AM

Al1000, that's good to know! thank you.

 

I found the article about not using sudo. I probably misread, here it is. He has all his Linux info uploaded as google docs. He certainly sounds certain about what he knows, a real fire cracker. Another thing he says to do is disable Updates. (Should I?)

 

Here is the paragraph about avoiding sudo. Which I don't get because installing or deleting anything can't be done without sudo. For this I need to input password. Then I am able to do whatever needs to be done. It seems to be the only way.

 

Right now I need to install my VPN which is already downloaded. Again, sudo is needed. And also, what is the difference between system admin applications and ordinary applications?

 

Only use sudo and gksudo when absolutely necessary

2. With sudo and gksudo you give yourself root permissions (administrator power). You should only do that for system administration applications and never for ordinary applications.

Unnecessary use of
sudo (and gksudo) can mess up your file and directory permissions, causing all kinds of weird malfunctions.

When you launch an ordinary application with sudo (or gksudo), it creates files and directories that are the property of root, and not of you. Plus it changes the ownership of some existing files to root.

Never launch ordinary applications with sudo (or gksudo). It's unnecessary, it's dangerous and you run a big risk of messing up the permissions of your own files.


Edited by cooljay, 30 May 2017 - 10:39 AM.


#10 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:03:37 AM

Posted 30 May 2017 - 10:39 AM

As for installing on your main laptop, a solution that I like is simply get another hard drive or SSD.  Pop out the old one, keep it safe, install onto the new device (prices are coming way down for drives).  They make some pretty neat cradles that have USB3 to the computer and you plug a drive into them to access the old drive as an external device.

 

The main reason I prefer doing this:  most of the problems wind up happening when you try and install dual boot, especially onto an existing windows system.  You wind up resizing partitions, you need to worry about boot loaders, all fun stuff, all potential "crap what did I do" points.  I keep it simple and buy a new disk.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#11 Al1000

Al1000

  • Global Moderator
  • 8,118 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:37 AM

Posted 30 May 2017 - 10:46 AM

Another thing he says to do is disable Updates. (Should I?)


Definitely not. That is bad advice, and I can't imagine why he said that. You get software updates, for example when a new version of Firefox is released, you'll want to download and install it to replace the old version.

Same goes for security updates. As with Windows, when vulnerabilities are found, patches are released in the form of updates. Not installing security updates equates to having an insecure system.

Never launch ordinary applications with sudo (or gksudo)


Good advice, but why would you? It's rather like saying "don't attempt to drive your car from the front passenger seat". :)

#12 Al1000

Al1000

  • Global Moderator
  • 8,118 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:37 AM

Posted 30 May 2017 - 10:50 AM

And also, what is the difference between system admin applications and ordinary applications?


By "system admin application" I expect he's referring to applications that only the root user (or normal user using sudo) can run, such as the examples mremski gave earlier, mount and umount.

Whereas by "ordinary applications" he'll be referring to applications that normal users can run, such as Firefox.

Edited by Al1000, 30 May 2017 - 10:51 AM.


#13 The-Toolman

The-Toolman

  • Members
  • 1,527 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:37 AM

Posted 30 May 2017 - 04:08 PM

Hey cooljay,


 

When I first started using Linux this is what I did.

 

I always found the "Software Center" a good place to start looking for software I was wanting to install just to see what was available.

 

If I was unable to find the software I was looking for I then started to search "Synaptic Package Manager" as it always seems to display some choices which the "Software Center" wasn't able to locate.

 

As I became more familiar with "Command Terminal" I then started using it for software I was wanting to install.

 

Just some thoughts.

 

The Toolman :wink:


"Under certain circumstances, profanity provides a relief denied even to prayer."

(Mark Twain)
 

"Inspiration can be found in a pile of junk. Sometimes, you can put it together with a good imagination and invent something."

(Thomas Edison)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users