|
I'm writing a shell script to automatically add a new user and update their password. I don't know how to get passwd to read from the shell script instead of interactively prompting me for the new password. My code is below.
adduser $1 passwd $1 $2 $2...
Started by Jared on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
So in your case
adduser "$1" echo "$2" | passwd "$1" --stdin
[ Update ] a few issues....
From " man 1 passwd ":
--stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe.
|
|
I want to scan the passwd file and print only lines if the user is not locked. That is, passwd -S $user does not return "Password: locked." I can do easily in ksh. What is the best way to do this in Perl?
Started by paul44 on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you're looking for a command-line way to do it or not, and the following code assumes that the output of passwd -S is exactly how you specified it (which probably won't work in practice), but this is one approach:
cat /etc/passwd....
|
|
Is there an easy way in Java to generate password hashes in same form as generated by "openssl passwd -1".
Example:
# openssl passwd -1 test $1$Gt24/BL6$E4ZsrluohHFxtcdqCH7jo.
I'm looking for a pure java solution that does not call openssl or any other...
Started by raffael on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It should be straightforward to convert it to pure Java. .
code for the C language version here .
|
Ask your Facebook Friends
|
I was writing a backup script and accidentally used
"mv /etc/passwd /home/backup"
I should have used "cp" I know.
I still have a ssh shell into this box
but I am not root, and i cannot su or sudo since the passwd file does not have my user id there.
How...
Started by mliu5715k on
, 15 posts
by 3 people.
Answer Snippets (Read the full thread at linuxquestions):
Hi mliu5715k,
Welcome to LQ!!!
Try this:
Code: cp /home/backup /home/passwd
and then:
Code: cp /home/passwd /etc/ If you have physical access to the box, use a live cd and copy the file back because only root can write or copy....
|
|
Hello,
While trying to assign password to one of my user, I am getting this error message
Code: serveradmin@openserver:~/LAMP$ sudo passwd salaryuser passwd: Authentication token manipulation error passwd: password unchanged
I also tried this -
Code: ...
Started by maverickaddicted on
, 7 posts
by 3 people.
Answer Snippets (Read the full thread at ubuntuforums):
|
|
Hi
root user creates a user using the useradd command. This command creates an entry in the /etc/passwd file. /etc/passwd file has rw permission for the root user. Now, if I happen to remove the w permission for the root user, useradd command still is...
Started by guruprasadpr on
, 4 posts
by 3 people.
Answer Snippets (Read the full thread at unix):
Code: # as root $ touch.
As long as it's not asking for something physically impossible, root can do it .
The "passwd.
/etc/passwd should have permissions 444 .
Simply put, root gets to break the rules.
|
|
I am parsing te /etc/passwd file and extracting the login and names alone.
But for some entries only login exist but no name. so i dont want to display those:
how i can check non emptiness for login and name in single if statement:
Code: #!/usr/bin/bash...
Started by pandeesh on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at unix):
You just need:
Code: if [ -n "$name" ]Is this what you're looking for?
Code: while IFS=: read....
Is an awk
Code: awk -F":" '$5 != "" && $1 != "" { print $1 } ' /etc/passwd
It will print username/passwd would be invalid.
|
|
Hi!
i want to extract from /etc/passwd file,the user and user info fileds, to a another file.I've tried this:
Code: cut -d ':' -f1 ':' -f6 < file
but cut can be used to extract olny one field and not two.
maybe with awk is this possible?
Started by strawhatluffy on
, 4 posts
by 3 people.
Answer Snippets (Read the full thread at unix):
Code: cut -d: -f1,3,5 file
Or with awk :
Code: awk -F: '{ print.
Cut can cut multiple fields.
|
|
Hi.
i have the accessibility to cat the /et/passwd file
in this file we see the paassword field but the password is in encrypted form
So, it can be possible to get the password encrypted string to convert it into human readable string via some md5 encryption...
Started by Rajesh1091 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at unix):
See
Code: man 3c crypt DES-crypt password can be brute forced fairly easily.
No it is not possible.
|
|
/etc/group
Code: tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root, daemon sys::3:root,bin,adm adm::4:root, daemon uucp::5:root
/etc/passwd
Code: mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ...
Started by chidori on
, 7 posts
by 4 people.
Answer Snippets (Read the full thread at unix):
But I'm just extending your attempt to a working solution:
Code: grep `grep 'tiadm' /etc/group | awk ....
Another:
Code: grep `grep 'tiadm' /etc/group | sed 's/.*:\([^,]*\),.*/\1/'` /etc/passwd wellThere could be more efficient ways.
|