Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

  1. Follow us on twitter - we shoot all of our new original content out as well as random messages. https://twitter.com/linuxdotorg
    Dismiss Notice

Sudo password

Discussion in 'Linux Security' started by hitlr society, Dec 2, 2018.

  1. hitlr society

    hitlr society New Member

    Joined:
    Nov 2, 2018
    Messages:
    5
    Likes Received:
    0
    i mean, login to sudo not using password user but using password special sudo..
    is there a special password for sudo?


    (Log in to hide this advertisement)

     
  2. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    2,318
    Likes Received:
    2,001
    hitlr society likes this.
  3. hitlr society

    hitlr society New Member

    Joined:
    Nov 2, 2018
    Messages:
    5
    Likes Received:
    0
    I'm using Debian 9 Stretch
     
  4. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    2,318
    Likes Received:
    2,001
    Installation of Debian 9 'Stretch' provides for the choice of using a separate password for Root.

    Did you choose that?

    Is that what you are asking about?

    Wizard
     
  5. hitlr society

    hitlr society New Member

    Joined:
    Nov 2, 2018
    Messages:
    5
    Likes Received:
    0
    i'm not choose separate password for Root.

    Example:
    i as user root and add new user (user_1) with permission sudo.

    When i as user_1 interact with terminal command line.

    Sudo nano /etc

    Debian will prompt for current user's password..

    My question..

    Can i setting password sudo without password current user's.?
    But with password for special sudo.. So, when i enter mode sudo i should enter password for sudo not with password current user
     
  6. arochester

    arochester Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 25, 2017
    Messages:
    428
    Likes Received:
    474
    Not sure that I fully understand this.

    Debian Wiki says
    ...and
     
  7. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    401
    Likes Received:
    844
    Are you asking if you can set a user to use sudo without prompting for a password?
     
  8. JTHR

    JTHR New Member

    Joined:
    Dec 3, 2018
    Messages:
    1
    Likes Received:
    0
    I think the question is something like this...
    Windows has an option to have Standard User A and Admin User B
    When logged into Standard User A you need to enter Admin User B's password to preform administrative tasks.
    Can you have a similar thing with Debian as You login with Standard User A and enter the "root" password which would be Admin User B's password in the example above.
     
  9. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    401
    Likes Received:
    844
    Here - let's cover a couple different things regardless of which Linux distribution you're using.

    Let's state some facts first..
    - every system will have a root user
    - you should NOT do day-to-day activities as the root user since accidents happen - not only something like deleting important system files, but you may end up creating new files owned by just root which may impact a regular user's use of a certain application in the future.

    Enter sudo - this tool lets otherwise unprivileged users perform actions in which root would otherwise only have access. For instance, editing the /etc/hosts file.

    As a regular user, you can open the file in an editor like vim (nano, emacs, etc..), you can even view the contents with tools like less/more/cat/etc.. but in order to actually save changes to it, you'll need to edit it with root privileges.

    This is where sudo comes in. Generally, when you add a regular/unprivileged user during installation, they are added to the sudoers file. When you get into a jam, you can use sudo to get things done..

    Let's say 'joe' wants to edit the /etc/hosts file. He would get it done by typing:
    Code:
    sudo vim /etc/hosts
    It will then prompt him for a password - here you'll input joe's password (not the root password).

    As long as joe is in the sudoers file and the password was correct (and the sudoers file isn't limiting him to certain commands) the file will open and he'll be able to change it and write it as the same filename.

    If you trust your system (ie: within your home network, no one else uses it, you have it VERY secure), then you can modify the sudoers file so that joe never has to enter a password for the sudo command..

    You can edit the sudoers file by typing:
    Code:
    sudo visudo
    This will open in your system's default editor.

    Scroll down and change:
    Code:
    joe ALL=(ALL) ALL
    to:
    Code:
    joe ALL=(ALL) NOPASSWD:ALL
    Now, when joe runs 'sudo' it won't ask him for a password.
     
  10. Lazydog

    Lazydog Member

    Joined:
    Jul 27, 2017
    Messages:
    86
    Likes Received:
    65
    My question is why would you want this? SUDO allows you to set limits on what the SUDO can and cannot do when using the command.

    Also you don't want one user to know another users password as this is unsafe.
     
  11. mal-2

    mal-2 New Member

    Joined:
    Dec 27, 2018
    Messages:
    24
    Likes Received:
    10
    preconfigured is:
    sudo <cmd> <- Password user_1
    su -c <cmd> <- Password root

    But I wouldnt recommend this way as you can mess up the file permissions. Thats because "sudo" does the command as user_1 with root privileges whereas "su -c" does the command as root with root privileges. If you create a file with "su -c" it belongs to root and usually cannot edit by unprivileged users.
     

Share This Page