Linux user disable password

Creating a user without a password

Nothing is wrong, the authentication failed as expected. You won’t get a «there is no password, you can’t login» error message.

Either create it as root and set the correct permissions, or execute su git as root where you don’t have to provide a password.

I just wanted to point out that letting the git user have Bash as a shell is a bad idea, security wise. That would allow users of this repo to get a shell in your server. If you set the shell to /usr/bin/git-shell you can limit their account to using git and nothing else. (You should also limit SFTP access but that can only be done from /etc/sshd_config). Now, once you changed the shell, «su» won’t work as-is. You’ll have to do «su -s /bin/sh git» instead.

7 Answers 7

The —disabled-password option will not set a password, meaning no password is legal, but login is still possible (for example with SSH RSA keys).

To create an user without a password, use passwd -d $username after the user is created to make the password empty. Note not all systems allow users with empty password to log in.

You’ve created a user with a “disabled password”, meaning that there is no password that will let you log in as this user. This is different from creating a user that anyone can log in as without supplying a password, which is achieved by specifying an empty password and is very rarely useful.

In order to execute commands as such “system” users who don’t log in normally, you need to hop via the root account:

If you want certain users to be able to run commands as the git user without letting them run commands as root, set up sudo (run visudo as root and add a line like %gitters ALL = (git) ALL ).

Ubuntu 19.10 seems like does not have —disabled-password parameter, could there be any alternative solution

@alper Write the full path: sudo -u git cat /wherever/main.py . Or add a cd command: sudo -u git sh -c ‘cd /wherever && cat main.py’ . If you want to be sure that the other user doesn’t get access to the current directory even if the command doesn’t do what was intended, change directories outside: (cd /wherever && sudo -u git cat main.py)

Читайте также:  Disk partition in kali linux

@alper You didn’t use the commands I posted. You used one of many variants (too many for me to guess the exact one) that would result in this particular error. You need to invoke a shell for cd and && .

If you want to access the system under the git user you should use sudo:

Create an user with empty password

sudo useradd test-user-0 echo test-user-0:U6aMy0wojraho | sudo chpasswd -e su test-user-0 

The password prompt still shows unfortunately.

But if you just hit enter without typing anything, and it logins as the user test-user-0 .

The -e flags tells chpasswd that the password is already encrypted, and U6aMy0wojraho is the hash of the empty string.

Terminal autologin with getty -a

On the terminal at least, you don’t need to create an user without a password to allow someone to not type their passwords every time.

So I believe that it should not be very hard to adapt that technique by modifying Ubuntu 18.04’s systemd init system scripts to setup a getty -a terminal as mentioned in that answer, although I haven’t tried to do it myself.

Источник

Q. How can I disable or lock a password for a User in Linux?

Some times it’s required to lock user not to login to the machine. This can be done by using passwd command. this command should be executed by root or super user. Execute below command lock a user.

passwd -l username

passwd -l surendra.

The above command will lock the user surendra prominently so that he can not login to the machine.

Once the password is locked or disabled !(negation sybol) will be added to password field in /etc/shadow file for that user.

Before password lock implemented, the entry for surendra as below.

surendra:$6$rZnP7SSN$emBz/./WkjSa9B:15615:0:99999:7.

After setting password lock:

surendra: ! $6$rZnP7SSN$emBz/./WkjSa9B:15615:0:99999:7.

If you try to login, you will get “Login incorrect“, This error is because ! in the password field of /etc/shadow file for user surendra.

Please follow our next post on unlocking the password.

Surendra Anne

Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.

Latest posts by Surendra Anne (see all)

  • Docker: How to copy files to/from docker container — June 30, 2020
  • Anisble: ERROR! unexpected parameter type in action: Fix — June 29, 2020
  • FREE: JOIN OUR DEVOPS TELEGRAM GROUPS — August 2, 2019
  • Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) — August 27, 2018
  • How to use ohai/chef-shell to get node attributes — July 19, 2018
Читайте также:  Linux меню загрузка параметры

Источник

How do I make Ubuntu not ask me for my password?

I’m confident that I do not need a password for my computer. How do I remove passwords for things like when the screensaver activates and installing software?

It’s easy enough to avoid the need to supply a password when you initially log in. But how do you do that on subsequent logins, i.e. when you log in after you’ve logged out? Or is that simply not possible?

5 Answers 5

While this statement is a general attitude that I dont agree with, in the spirit of answering your question, I’ll continue without further biased objectification.

There are a few areas of the system that you can utilize to process this request. First being the «Screensaver Password» that you mention. Go to System > Preferences > Screensaver In there, you need to disable the checkbox titled «ALock screen when screensaver is active»

enter image description here

On the login screen you can set an auto-login to a user. System > Preferences > Login (this may be system > administration > login.. please verify as I’m not in-front of my Linux PC) you can then set the system to auto-login a given user.

enter image description here

However please note that after you have logged in, if you have stored passwords in your couchdb it will prompt you to enter your password to unlock the keyring so your wifi can auto connect (as an example)

Regarding your software installation password, there is no way to default this that I’m aware of, as sudo will ask you for a password. This security model is enabled so you have to think about what you’re doing before you make system-wide changes such as installing software.

Please see: this link. it will help to explain why the current security model should be the default.

Источник

Can I set my user account to have no password?

If I attempt to change my password to nothing by opening «User Accounts», the «Change» button remains greyed out: How do I change my password to be empty? I know you can set Ubuntu to automatically log you in, but I want my password to be empty, I never want to type in a password to authenticate myself as that user. I know that there are reasons why this might not be a good idea, but I want to know if it is even possible. I’m using Ubuntu 12.10.

@Kaz It doesn’t if you follow all the steps in the answer, including the step that was linked to at the end.

Читайте также:  Мультизагрузочная флешка несколько linux

6 Answers 6

You can’t do that using the GUI tool, but you can using the terminal.

    First, if your user has sudo privileges, you must enable its NOPASSWD option. Otherwise, sudo will ask for a password even when you don’t have one, and won’t accept an empty password. To do so, open the sudoers configuration file with sudo visudo , and add the following line to the file, replacing david with your username:

If you ever get prompted for a password, just type enter and it should work. I’ve tested this answer with LightDM, the lock screen, sudo , gksu , and it works.

Any new visudo edits such as nopasswd should be added to the end so no other setting overwrites the entry.

This did not work for me (Ubuntu 16.04) via ssh login. It still asks for a password, but no password is accepted (blank or the old one or the one for the ssh key).

On Debian I got the message «Sorry that didn’t work try again» when I try to log with empty password after the command passwd david -d . And now I can’t login with the old password too.

Warning: Be careful once you remove your password using this method, you won’t be able to authenticate yourself to prove you have admin rights, in a GUI or in the terminal (like installing an application using Synaptic, or using sudo through the command-line). This is because of bug #1168749.

Only do this if the user is not the only admin user.

This has been tested on Ubuntu 12.04 and 12.10.

  1. Make sure that you click on Unlock to be able to accomplish the tasks below: Unlock screenshot
  2. Go into user accounts, and click on the password field:
  3. Once the window opens, click on the down arrow to the right of «Action».
  4. and change it to «Log in without a password», and then click on «Change»:
  5. Optionally, you can also enable automatic log-in, like this: Screenshot

To give the user a password again after running this procedure, you can’t use a GUI (bug #882255), you have to use the command-line:

  1. Log in as another user with admin priveleges. (Remember, the original one cannot run with admin privileges without a password using this method.)
  2. Run the following in a terminal:

Again, I must warn you that once you remove the password, you won’t be able to authenticate yourself in the GUI or a terminal, like installing an application using Synaptic, or using sudo on the command-line.

Источник

Оцените статью
Adblock
detector