ubuntu中出现:passwd: unrecognized option '--stdin'

1、redhat(centos)中

[root@localhost Desktop]# hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer
           Chassis: n/a
        Machine ID: 7dcb3b04ae354b138b8a02219c0e5dcb
           Boot ID: ca65b9702b0e49e499e3a708f28d3a57
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64
[root@localhost Desktop]# echo "123456" | passwd --stdin liujiaxin01   ## 修改用户密码为123456
Changing password for user liujiaxin01.
passwd: all authentication tokens updated successfully.

 

2、ubuntu中

root@ubuntu01:/home/test# hostnamectl
   Static hostname: ubuntu01
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 5bf1e11dc02047718a7a7146b52f9b07
           Boot ID: 6e92c587f51e49118fc99d79d86d8a5c
    Virtualization: vmware
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-37-generic
      Architecture: x86-64
root@ubuntu01:/home/test# echo "123456" | passwd --stdin liujiaxin01   ## 无法使用此命令进行修改
passwd: unrecognized option '--stdin'
Usage: passwd [options] [LOGIN]

Options:
  -a, --all                     report password status on all accounts
  -d, --delete                  delete the password for the named account
  -e, --expire                  force expire the password for the named account
  -h, --help                    display this help message and exit
  -k, --keep-tokens             change password only if expired
  -i, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --lock                    lock the password of the named account
  -n, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -q, --quiet                   quiet mode
  -r, --repository REPOSITORY   change password in REPOSITORY repository
  -R, --root CHROOT_DIR         directory to chroot into
  -S, --status                  report password status on the named account
  -u, --unlock                  unlock the password of the named account
  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
  -x, --maxdays MAX_DAYS        set maximum number of days before password
                                change to MAX_DAYS

 

ubuntu中可以使用:

root@ubuntu01:/home/test# hostnamectl
   Static hostname: ubuntu01
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 5bf1e11dc02047718a7a7146b52f9b07
           Boot ID: 6e92c587f51e49118fc99d79d86d8a5c
    Virtualization: vmware
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-37-generic
      Architecture: x86-64
root@ubuntu01:/home/test# echo liujiaxin01:123456 | chpasswd

 

参考:https://blog.csdn.net/suyues/article/details/100027634

 

posted @ 2022-03-27 20:40  小鲨鱼2018  阅读(1272)  评论(0编辑  收藏  举报