
이 사용자는 다음 명령을 사용하여 생성되었습니다.
sudo adduser --system --home=/opt/user --group user
하지만 이제 해당 사용자가 로그인할 수 있기를 바랍니다. 을 사용하여 해당 사용자가 될 수도 있지만 sudo
비밀번호를 사용하여 직접 로그인하고 싶습니다. 나는 다음 명령을 사용해 보았습니다.
sudo passwd user
사용자의 비밀번호를 추가할 수 있습니다. 로그인을 시도하면 로그인되지만 즉시 종료됩니다.
답변1
user
옵션 에서 지정한 시스템 계정이므로 로그인할 수 없습니다 --system
. 시스템 계정은 인간 사용자가 아닌 데몬이나 서비스용이므로 /bin/false
로그인 셸에 제공됩니다. 를 입력하면 grep '^user' /etc/passwd
다음과 같은 결과가 나타납니다.
user:x:117:123::/opt/user:/bin/false
user
로그인을 허용하려면 usermod를 사용하여 로그인 셸을 bash로 변경할 수 있습니다.
usermod -s /bin/bash user
또는 /etc/passwd
직접 편집할 수도 있습니다. user
의 UID, GID 및 홈 디렉토리 위치 에 대한 다른 변경 사항을 적용할 수도 있습니다 .
답변2
-m 플래그 없이 사용자가 생성되었을 수 있습니다.
-r, --system
Create a system account.
System users will be created with no aging information in /etc/shadow, and their numeric identifiers are choosen in the SYS_UID_MIN-SYS_UID_MAX range, defined in /etc/login.defs, instead of UID_MIN-UID_MAX (and their GID counterparts for the creation of groups).
Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.
-m, --create-home
Create the user's home directory if it does not exist. The files and directories contained in the skeleton directory (which can be defined with the -k option) will be copied to the home directory.
useradd will create the home directory unless CREATE_HOME in /etc/login.defs is set to no.
편집 : 또한 참조하십시오이것다른 질문에 답해 보세요.
답변3
사용자가 잠긴 것 같군요. 시도해 보세요.
usermod -U user
또한 살펴보세요 /etc/shadow
. 사용자가 있는 줄은 이렇게 시작해야 합니다.
user:$6$SALT...
만약 라인이
user:!!:..
user:*:...
그러면 계정이 잠깁니다.