Quiero ser capaz de iniciar sesión con diferentes configuraciones pero siendo el mismo "usuario". Por lo tanto, he añadido un usuario 2 º con el mismo UID/GUID diferentes directorio y ahora cuando inicio Ubuntu el sistema solo cuelga. Si elimino el usuario 2 º de la passwd
y shadow
archivos, el sistema arranca bien.
Respuesta
¿Demasiados anuncios?Normalmente es mala idea para editar el /etc/passwd
y /etc/shadow
archivo a mano. Yo recomiendo usar el sistema de herramientas para eso. Además de que, mientras que usted puede tener un usuario compartir el mismo GUID con otro usuario, el líquido tiene que ser único para cada usuario. Por lo que el inicio más probable es que no sea Linux prevenir el inicio de las aplicaciones necesarias y/o a la insuficiencia de las aplicaciones de espera de los Uidos a ser único.
Un mejor enfoque de los dos usuarios compartir un directorio con el grupo de gestión para hacerlo. Consulte la Documentación sobre gestión de usuarios o navegar a Pedir Ubuntu para posibles guías:
Sin embargo, usted puede crear un usuario simplemente ejecutando el siguiente comando:
sudo useradd -U -m -G <additional groups here> <user-name>
Esto va a agregar un usuario a su sistema de trabajo. Explicación de la anterior línea de man 8 useradd
(muy acortado a sólo la mayoría de las opciones habituales, para completar el panorama, ver el hombre de la página):
OPCIONES
The options which apply to the useradd command are: -c, --comment COMMENT Any text string. It is generally a short description of the login, and is currently used as the field for the user's full name. -g, --gid GROUP The group name or number of the user's initial login group. The group name must exist. A group number must refer to an already existing group. If not specified, the behavior of useradd will depend on the USERGROUPS_ENAB variable in /etc/login.defs. If this variable is set to yes (or -U/--user-group is specified on the command line), a group will be created for the user, with the same name as her loginname. If the variable is set to no (or -N/--no-user-group is specified on the command line), useradd will set the primary group of the new user to the value specified by the GROUP variable in /etc/default/useradd, or 100 by default. -G, --groups GROUP1[,GROUP2,...[,GROUPN]]] A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option. The default is for the user to belong only to the initial group. -k, --skel SKEL_DIR The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd. This option is only valid if the -m (or --create-home) option is specified. If this option is not set, the skeleton directory is defined by the SKEL variable in /etc/default/useradd or, by default, /etc/skel. If possible, the ACLs and extended attributes are copied. -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. By default, if this option is not specified and CREATE_HOME is not enabled, no home directories are created. -M Do no create the user's home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes. -s, --shell SHELL The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell specified by the SHELL variable in /etc/default/useradd, or an empty string by default. -U, --user-group Create a group with the same name as the user, and add the user to this group. The default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPS_ENAB variable in /etc/login.defs.
Por lo -U
va a crear un grupo de usuarios con nombres parecidos a los de usuario-nombre de la GUID coincide con los usuarios UID. -m
va a crear el directorio home de los usuarios en /home/<user-name>
y -G
le permite dar más grupos a los que este usuario debe pertenecer a. Usted puede agregar grupos, más tarde, también. Los grupos de Ubuntu agrega a la principal usuario adm
, cdrom
, sudo
, dip
, plugdev
, lpadmin
y sambashare
. Para agregar grupos más tarde, podrá usar el siguiente comando:
sudo usermod -aG <group-or groups> <user-name>
Finalmente, el usuario debe tener una contraseña que se puede establecer con:
sudo passwd <username>
Esto concluye el usuario el proceso de creación de una terminal.
Hay una combinación de comandos disponibles también llamado adduser
que automatiza algunos de los procesos que visto se mencionó anteriormente, para su uso echar un vistazo a man 8 adduser
.