Choose style:

Author Topic: CLI - That old chestnut [Solved]  (Read 1717 times)

0 Members and 1 Guest are viewing this topic.

Offline cavy

  • Trusted User
  • Member
  • *****
  • Posts: 477
  • Karma: 97
  • Caveman
    • View Profile
  • Peppermint version(s): Peppermint Ten
CLI - That old chestnut [Solved]
« on: November 10, 2014, 10:28:27 am »
Hi guys, I have that old chestnut, CLI confusion.

I'm doing the edX LFS101 course and reached the CLI chapter, and fell at the first hurdle, where the result didn't match the authors example, how to set up "su" and "sudo". As "sudo" is a crucial part of the system, I don't want to drop a spanner in the works.

I have followed several well written articles in this forum and changed aspects of my system using the "sudo" command without any fuss and wondering why, what appears to be a simple command in the terminal of "su" ENTER password on prompt, is answered with "Authentication on failure" or "Authentication failure" not the expected $ su Password: #.

They mention I need to create a new file in the /etcsudoers.d/ directory and that some systems may need to edit the #chmod 440/etc/sudoers.d/<your-username> but I'm unsure of how to proceed, as I have encountered similar issues in the past. Or I'm fundamentally missing the point with CLI?

Please click link to see screen shot https://sites.google.com/site/clithatoldchestnut/
« Last Edit: November 14, 2014, 07:07:44 am by cavy »
“We know what we are, but not what we may be.”

Various machines to sample the delights of Linux

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4893
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: CLI - That old chestnut
« Reply #1 on: November 10, 2014, 11:36:26 pm »
Hi cavy, this link provides a really good rundown of the advantages of using sudo over su.  It also saves me a lot of typing ;D: http://mylinuxbook.com/sudo-vs-su-in-ubuntu-linux/.  I hope this clarifies things for you - have fun  ;).
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26454
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: CLI - That old chestnut
« Reply #2 on: November 11, 2014, 09:54:30 am »
Ubuntu and it's derivatives don't have a user accessible  "root" account (so no root password), instead using "sudo" to temporarily elevate privileges with the users own password (will only work for people in the sudo group, which adds them to the sudoers file).

the command "su" (switch user) is normally used in this format
su <user account to switch to>

but when invoked without a username automatically selects the "root" account, so is the same as "su root" .. when invoked on its own in an Ubuntu derivative it will attempt to switch to the root account, but that account doesn't have a password so any attempt to enter a password will fail.

There are multiple ways to do the same thing .. here's two of them:-
Code: [Select]
sudo su
whiich will use the users password (as long as he's in the sudo group) to elevate privileges .. then run "su" with already elevated privileges.

or

Code: [Select]
sudo -s
Which will use the users password (as long as he's in the sudo group) to elevate privileges, then open an interactive shell with those elevated privileges

For more info see here:
https://help.ubuntu.com/community/RootSudo

FYI, it *is* possible to have an active root account (with password) in Ubuntu and it's derivatives .. but is inadvisable unless you know what you're doing.
« Last Edit: November 11, 2014, 09:56:48 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline cavy

  • Trusted User
  • Member
  • *****
  • Posts: 477
  • Karma: 97
  • Caveman
    • View Profile
  • Peppermint version(s): Peppermint Ten
Re: CLI - That old chestnut
« Reply #3 on: November 12, 2014, 06:30:07 am »
Thank you both,  :D that has helped, the light at the end of the tunnel doesn't seem so dark   :-\ . I'm going keep plugging away and hopefully it will fall into place and later wonder why it was so hard to grasp.  ::)

“We know what we are, but not what we may be.”

Various machines to sample the delights of Linux