LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to add an user, without password?? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-an-user-without-password-204674/)

cenzole 07-13-2004 06:12 PM

How to add an user, without password??
 
is it possible to add an user there hav NO password, so you kan login without passwd??

trickykid 07-13-2004 06:53 PM

Why would you want a user without an actual password? That's just opening up all kinds of trouble if this machine is on the internet or a network. Why not setup a password for the user but have them autologin, but only if they are locally on the machine, etc? Search the forums, its asked all the time.

cenzole 07-13-2004 06:56 PM

why i need it is my problem, i would just be glad if you could tell me how to.. :)

kilou 07-13-2004 06:59 PM

i dont think it can actually be done...

but try removing the password directly from /etc/shadow .. i never tried this nor do i recommend it.. but it's your box...

cenzole 07-13-2004 07:04 PM

it can be done :) wake up it is unix everything is possible, i read it once in a magazine :)

But i cant remember..

kilou 07-13-2004 07:06 PM

good point.. everything can always be done...
but i never heard of this being needed ..

cenzole 07-13-2004 07:18 PM

i dont realy need it just wondering how to set it up

homey 07-13-2004 07:32 PM

Quote:

why i need it is my problem, i would just be glad if you could tell me how to..
Not a very polite response.

Anywho, use these commands to add a user called fred with no password
adduser fred
passwd -f -u fred

cereal83 07-13-2004 08:45 PM

Well I just took a linux course and I read that if you create a new user with no password, it is disabled until a password is added so I don't know how you can work around that.

rvega 01-26-2008 03:04 PM

polite?
 
Quote:

Originally Posted by homey (Post 1044912)
Not a very polite response.

On the contrary, what is impolite is wasting people's time trying to dissuade them from their purpose instead of answering the question asked. If you can't/don't want to answer the question, just leave it alone.

I don't mind seeing cautionary advice following useful information, but am sick of reading, all over the net, worthless "answers" to simple questions. The OP didn't ask for security advice or whether what he wanted to do was a good idea. If people only ever tried things that everybody else thought were good ideas, where would we be?

In fact, there are instances in which is makes good sense to create a user with no password and control login with ssh keys. I use this technique on several production systems. Not to mention private or research environments (e.g. private LANs or virtual-machine networks) where security simply isn't an issue.

jonmcc 02-09-2009 12:58 PM

There is a hack to do this which works. Replace the user's /etc/shadow password entry with this string...
$1$VNMbpxGH$sew7cnwH9ixU.x27UbFNn.
...e.g...
anon1:$1$VNMbpxGH$sew7cnwH9ixU.x27UbFNn.:14284:0:99999:7:::

I also had to do this because I wanted an FTP user that didn't have to enter a password. I could have used anonymous, but I needed a few user's like this. I highly recommend you set a shell of /sbin/nologin (in /etc/passwd) for such a user, e.g..
anon1:x:6513:6513:Anonymous FTP User NoPass:/home/qvtest:/sbin/nologin

NOTE: The above string was generated by this script...

#!/usr/bin/perl
################################################################################
# Generate an MD5 hash for a string.
# Created to allow me to set a blank Linux password. Required this to create
# multiple VsFTP accounts with anonymous style credientials.
#
# If all you want is the MD5 Hash for NULL (blank password) here's one...
# $1$VNMbpxGH$sew7cnwH9ixU.x27UbFNn.
#
# Advice: If replacing a Linux password with a blank string, ensure you give
# the user a shell of /sbin/nologin as you wouldn't want them to login!
################################################################################
# Load dependancies...
# perl -MCPAN -e 'install Crypt::PasswdMD5'
################################################################################

use strict;
use Crypt::PasswdMD5 qw(unix_md5_crypt);
my @salt = ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' );
my %encrypted;


sub abort {
print "ABORT: $_[0]\n";
exit 1
}


sub gensalt { #------------------------------------------------------------
# uses global @salt to construct salt string of requested length
my $count = shift;

my $salt;
for (1..$count) {
$salt .= (@salt)[rand @salt];
}

return $salt;
} # end gensalt


sub get_encryptedpw { #--------------------------------------------------
my $unencrypted="$_[0]";

# generate traditional (weak!) DES password, and more modern md5
$encrypted{des} = crypt( $unencrypted, gensalt(2) );
$encrypted{md5} = unix_md5_crypt( $unencrypted, gensalt(8) );

return %encrypted;
}

################################################################################
print "Enter password string to encrypt (can be blank) : ";
my $password = <STDIN>;
chomp $password;

get_encryptedpw($password);

print "Plaintext \"$password\" = MD5 Hash: $encrypted{md5}\n";
print "\nReplace the /etc/shadow password string with the above to force pass change\n";

msright1981 02-10-2009 11:45 AM

Wow everything is possible with Linux
 
Haha, If you had asked me earlier I would thought it was not possible. I guess as our fellow here said everything is possible with Linux you just have to digg deep enough :).

saagar 02-10-2009 02:38 PM

useradd someuser
passwd -d someuser..

jonmcc 02-11-2009 04:14 AM

Quote:

Originally Posted by saagar (Post 3438806)
useradd someuser
passwd -d someuser..

...if only it were that easy. That just locks the account. You can't login. You need to fool the system into accepting a blank password.

By the way, you can only use a blank password with services like FTP/telnet. If you wanted to use a blank password with SSH, you'd need to add "PermitEmptyPasswords yes" to /etc/sshd_config. Having said that, you should be using SSH keys if you want promptless access over SSH. Basically avoid 'no password' accounts if you give the user a shell!

mop 06-22-2009 11:41 AM

echo "newuser::0:0::/:/bin/bash" >> /etc/passwd


All times are GMT -5. The time now is 07:53 PM.