简介
A
ab
accept
ack
ag
alias
apachectl
apk
apropos
apt-get
aptitude
apt-key
apt-sortpkgs
ar
arch
arj
arp
arpd
arping
arptables
arpwatch
as
at
atop
atq
atrm
awk
axel
B
badblocks
base64
basename
batch
bc
bg
bind
blkid
blockdev
bmodinfo
break
builtin
bunzip2
bye
bzcat
bzcmp
bzdiff
bzgrep
bzip2
bzip2recover
bzless
bzmore
C
cal
cancel
cat
cd
cdrecord
chage
chattr
chcon
chfn
chgrp
chkconfig
chmod
chown
chpasswd
chroot
chsh
cksum
clear
clock
clockdiff
cmp
col
colrm
column
comm
command
compress
consoletype
continue
convertquota
cp
cpio
createrepo
crontab
csplit
cu
cupsdisable
cupsenable
curl
cut
D
date
dc
dd
declare
depmod
df
dhclient
dhcpd
dhcrelay
diff
diff3
diffstat
dig
dircolors
dirname
dirs
disown
dmesg
dmidecode
dnf
dnsdomainname
docker
domainname
dos2unix
dpkg-deb
dpkg-divert
dpkg-preconfigure
dpkg-query
dpkg-reconfigure
dpkg-split
dpkg-statoverride
dpkg-trigger
dpkg
dris
dstat
du
dump
E
e2fsck
e2label
echo
ed
edquota
egrep
eject
elinks
elm
emacs
enable
env
ethtool
ex
exec
exit
expand
export
exportfs
expr
F
false
fc
fdisk
fg
fgrep
file
find
findfs
finger
firewall-cmd
fishshell
fmt
fold
fping
free
fsck
ftp
ftpcount
ftpshut
ftptop
ftpwho
fuser
G
gcc
gcov
gdb
get_module
getenforce
getent
getsebool
git
gpasswd
gpm
grep
groupadd
groupdel
groupmems
groupmod
groups
grpck
grpconv
grpunconv
grub
grub2-mkconfig
grub2-set-default
gunzip
gzexe
gzip
H
halt
hcitool
hdparm
head
help
hexdump
history
host
hostid
hostname
hostnamectl
hping3
htdigest
htop
htpasswd
hwclock
I
iconv
id
ifcfg
ifconfig
ifdown
ifstat
iftop
ifup
indent
info
init
inotifywait
insmod
install
iostat
iotop
ip
ip6tables-restore
ip6tables-save
ip6tables
ipcalc
ipcrm
ipcs
iperf
iptables-restore
iptables-save
iptables
iptraf
iptstate
iscsiadm
ispell
J
jed
jobs
joe
join
journalctl
jq
jwhois
K
kernelversion
kexec
kill
killall
L
last
lastb
lastlog
ld
ldconfig
ldd
less
let
lftp
lftpget
lha
lilo
ln
lnstat
local
locate
logger
login
logname
logout
logrotate
logsave
logwatch
look
losetup
lp
lpadmin
lpc
lpq
lpr
lprm
lpstat
ls
lsattr
lsb_release
lsblk
lscpu
lsmod
lsof
lspci
lsusb
ltrace
lvcreate
lvdisplay
lvextend
lvreduce
lvremove
lvresize
lvscan
lynx
M
mail
mailq
mailstat
make
man
mapfile
md5sum
mesg
mii-tool
mkbootdisk
mkcert
mkdir
mke2fs
mkfs
mkinitrd
mkisofs
mknod
mkswap
mktemp
modetest
modprobe
more
mount
mpstat
mtools
mtr
mv
mysql
mysqladmin
mysqldump
mysqlimport
mysqlshow
N
named-checkzone
nano
nc
ncftp
neofetch
nethogs
netstat
newusers
nfsstat
ngrep
nice
nisdomainname
nl
nm
nmap
nmcli
nohup
nologin
nproc
nslookup
ntpdate
ntsysv
O
objdump
od
openssl
P
pacman
parted
partprobe
passwd
paste
patch
pathchk
perl
pfctl
pgrep
php
pico
pidof
pidstat
pigz
ping
ping6
pip
pkexec
pkill
pmap
popd
poweroff
ppp-off
pr
printf
protoize
prtstat
ps
pssh
pstack
pstree
pushd
pv
pvchange
pvck
pvcreate
pvdisplay
pvremove
pvs
pvscan
pwck
pwconv
pwd
pwdx
pwunconv
Q
quota
quotacheck
quotaoff
quotaon
R
rcconf
rcp
read
readelf
readonly
reboot
reject
rename
renice
reposync
repquota
resize
restore
restorecon
return
rev
rexec
rlogin
rm
rmdir
rmmod
route
rpm
rpm2cpio
rpmbuild
rpmdb
rpmquery
rpmsign
rpmverify
rsh
rsync
runlevel
S
sar
scp
screen
script
scriptreplay
sed
seinfo
semanage
sendmail
seq
service
sesearch
set
setfacl
setpci
setsebool
setsid
sftp-server
sftp
sh
sha256sum
shift
shopt
showmount
shuf
shutdown
skill
slabtop
sleep
slocate
smartmontools
smbclient
smbpasswd
sort
source
speedtest-cli
spell
split
squid
squidclient
ss
ssh-add
ssh-agent
ssh-copy-id
ssh-keygen
ssh-keyscan
ssh
sshd
sshpass
startx
stat
strace
strings
stty
su
sudo
sum
supervisord
suspend
swapoff
swapon
sync
sysctl
syslog
systemctl
systool
T
tac
tail
tailf
talk
tar
tcpdump
tcpreplay
tee
telinit
telnet
tempfile
test
tftp
time
timedatectl
times
tload
tmux
top
touch
tput
tr
tracepath
traceroute
trap
tree
true
tty
type
U
ulimit
umask
umount
unalias
uname
unarj
uncompress
unexpand
uniq
unlink
unprotoize
unrar
unset
unzip
updatedb
uptime
useradd
userdel
usermod
usernetctl
users
uucico
uupick
uuto
V
vdfuse
vgchange
vgconvert
vgcreate
vgdisplay
vgextend
vgreduce
vgremove
vgrename
vgscan
vi
vmstat
volname
W
w
wait
wall
watch
wc
wget
whatis
whereis
which
who
whoami
write
X
xargs
xauth
xclip
xhost
xinit
xlsatoms
xlsclients
xlsfonts
xrandr
xset
xz
Y
yes
ypdomainname
yum
Z
zcat
zfore
zip
zipinfo
zipsplit
znew
其他
7z
passwd - Linux命令大全 - 笔下光年
网站首页
passwd
用于让用户可以更改自己的密码 ## 补充说明 **passwd命令** 用于设置用户的认证信息,包括用户密码、密码过期时间等。系统管理者则能用它管理系统用户的密码。只有管理者可以指定用户名称,一般用户只能变更自己的密码。 ### 语法 ```shell passwd(选项)(参数) ``` ### 选项 ```shell -d:删除密码,仅有系统管理者才能使用; -f:强制执行; -k:设置只有在密码过期失效后,方能更新; -l:锁住密码; -s:列出密码的相关信息,仅有系统管理者才能使用; -u:解开已上锁的帐号。 ``` ### 参数 用户名:需要设置密码的用户名。 ### 知识扩展 与用户、组账户信息相关的文件 存放用户信息: ```shell /etc/passwd /etc/shadow ``` 存放组信息: ```shell /etc/group /etc/gshadow ``` 用户信息文件分析(每项用`:`隔开) ```shell 例如:jack:X:503:504:::/home/jack/:/bin/bash jack # 用户名 X # 口令、密码 503 # 用户id(0代表root、普通新建用户从500开始) 504 # 所在组 : # 描述 /home/jack/ # 用户主目录 /bin/bash # 用户缺省Shell ``` 组信息文件分析 ```shell 例如:jack:$!$:???:13801:0:99999:7:*:*: jack # 组名 $!$ # 被加密的口令 13801 # 创建日期与今天相隔的天数 0 # 口令最短位数 99999 # 用户口令 7 # 到7天时提醒 * # 禁用天数 * # 过期天数 ``` ### 实例 如果是普通用户执行passwd只能修改自己的密码。如果新建用户后,要为新用户创建密码,则用passwd用户名,注意要以root用户的权限来创建。 ```shell [root@localhost ~]# passwd linuxde # 更改或创建linuxde用户的密码; Changing password for user linuxde. New UNIX password: # 请输入新密码; Retype new UNIX password: # 再输入一次; passwd: all authentication tokens updated successfully. # 成功; ``` 普通用户如果想更改自己的密码,直接运行passwd即可,比如当前操作的用户是linuxde。 ```shell [linuxde@localhost ~]$ passwd Changing password for user linuxde. # 更改linuxde用户的密码; (current) UNIX password: # 请输入当前密码; New UNIX password: # 请输入新密码; Retype new UNIX password: # 确认新密码; passwd: all authentication tokens updated successfully. # 更改成功; ``` 比如我们让某个用户不能修改密码,可以用`-l`选项来锁定: ```shell [root@localhost ~]# passwd -l linuxde # 锁定用户linuxde不能更改密码; Locking password for user linuxde. passwd: Success # 锁定成功; [linuxde@localhost ~]# su linuxde # 通过su切换到linuxde用户; [linuxde@localhost ~]$ passwd # linuxde来更改密码; Changing password for user linuxde. Changing password for linuxde (current) UNIX password: # 输入linuxde的当前密码; passwd: Authentication token manipulation error # 失败,不能更改密码; ``` 再来一例: ```shell [root@localhost ~]# passwd -d linuxde # 清除linuxde用户密码; Removing password for user linuxde. passwd: Success # 清除成功; [root@localhost ~]# passwd -S linuxde # 查询linuxde用户密码状态; Empty password. # 空密码,也就是没有密码; ``` 注意:当我们清除一个用户的密码时,登录时就无需密码,这一点要加以注意。
上一篇:
partprobe
下一篇:
paste