Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everyone,
The code snippet works fine (that means it creates a user, sets a password) but when I try to login as the recently created user, it produces "su: Authentication token manipulation error" error. Please help me understand what's wrong.
Code:
#!/bin/bash
# This script creates a new user on the local system.
# You will be prompted to enter the username (login), the person name, and a password.
# The username, password, and host for the account will be displayed.
# Make sure the script is being executed with superuser privileges.
if [[ "${UID}" -ne 0 ]]
then
echo 'Please run with sudo or as root.'
exit 1
fi
# Get the username (login).
read -p 'Enter the username to create: ' USER_NAME
# Get the real name (contents for the description field).
read -p 'Enter the name of the person or application that will be using this account: ' COMMENT
# Get the password.
read -p 'Enter the password to use for the account : ' PASSWORD
# Create the account.
useradd -c "${COMMENT}" -m ${USER_NAME}
# Check to seeif the useradd command succeded.
# We don't want to tell the user that an account was created when it hasn't been.
if [[ "${?}" -ne 0 ]]
then
echo 'The account could not be created.'
exit 1
fi
# Set the password
echo ${PASSWORD} | passwd --stdin ${USER_NAME}
if [[ "${?}" -ne 0 ]]
then
echo 'The password for the account could not be set.'
exit 1
fi
# Force password change on first login.
passwd -e ${USER_NAME}
# Display the username, password, and the host where the user was created.
echo #blank line
echo 'username:'
echo "${USER_NAME}"
echo
echo 'password:'
echo "${PASSWORD}"
echo
echo 'host:'
echo "${HOSTNAME}"
exit 0
Hi, I created a user 'amit', and tried to login as following:
Code:
[vagrant@localusers shellclass]$ su - amit
Password:
You are required to change your password immediately (ro
ot enforced)
Changing password for amit.
(current) UNIX password:
su: Authentication token manipulation error
My guess is that the password entered at the first login doesn't meet the minimum requirements for passwords on the system. i.e.; too short, mixed case, etc.
My guess is that the password entered at the first login doesn't meet the minimum requirements for passwords on the system. i.e.; too short, mixed case, etc.
Sorry. I meant the password entered at the su -, which then required a new password to be entered...although, presumably, that test was being done by su'ing from a different unprivileged user, as an su done by root wouldn't even ask for a password, afaik.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.