adduser user1 -u 601
passwd user1
*prompts for password* enter redhat
vim /etc/passwd
arrow key down until you see
user1:x:601:1003::home/user1:/bin/bash
press i
change it to...
user1:x:601:1003::/home/user1:/sbin/nologin
Press Esc
Type :wq
Press Enter
to double check
grep user1 /etc/passwd
output: user1:x:601:1003::/home/user1:/sbin/nologin
test to make sure account is unable to login
su - user1
expected output: "This account is currently not available."
U R right but you can still create the account and you just get the following warning "useradd warning: user1's uid 601 outside of the UID_MIN 1000 and UID_MAX 60000 range" you can also overcome by customising your login.defs
This is not true.
From /etc/login.defs:
# Min/max values for automatic uid selection in useradd(8)
#
UID_MIN 1000
UID_MAX 60000
it is for *automatic* selection. You can specify manually whatever you want.
useradd -u 601 -s /sbin/nologin user1
passwd user
(enter redhat)
cat /etc/passwd to check shell
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
prep4life
3 weeks, 6 days agoDadash
1 year agoLazylinux
7 months, 3 weeks agoly01
8 months, 3 weeks agodeepbrown
1 year, 10 months agolgu
3 years, 5 months ago