Check Whether a User Exists

后端 未结 17 2035
清歌不尽
清歌不尽 2020-11-29 17:31

I want to create a script to check whether a user exists. I am using the logic below:

# getent passwd test > /dev/null 2&>1
# echo $?
0
# getent pa         


        
17条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 17:47

    Login to the server. grep "username" /etc/passwd This will display the user details if present.

提交回复
热议问题