Создание пользователя с несколькими параметрами команд

С помощью xclip вы можете взаимодействовать с буфером обмена X (и дополнительным выбором). Конкретная задача в вашем вопросе, вставить текст, который был скопирован в другом месте, требует копирования содержимого буфера обмена. Вы можете использовать ssh для передачи текста из одного буфера обмена в другой. Конечно, это лучше всего подходит для входа в систему без пароля:

После копирования на firstPc вы запускаете secondPc:

$ ssh firstPc 'DISPLAY=:0 xclip -o -selection clipboard' | xclip -i  -selection clipboard

Теперь вы можете вставить на secondPc.

Обратите внимание, что буфер обмена может содержать не только текст, но и более структурированные данные. Он может содержать одни и те же данные в нескольких форматах.

5
задан 14 December 2017 в 19:05

6 ответов

Вы можете сделать это с помощью useradd. Я добавил строку, чтобы доказать, что это возможно. В этом случае passwd:

   -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.

   -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.

   -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.

   -p, --password PASSWORD
       The encrypted password, as returned by crypt(3). The default is to
       disable the password.

       Note: This option is not recommended because the password (or
       encrypted password) will be visible by users listing the processes.

       You should make sure the password respects the system's password
       policy.
[!d]]

Итак, вам стоит сделать это в два этапа, таким образом, пароль не регистрируется системой.

sudo useradd -U -m -G <group> <user-name>
sudo passwd <user-name>

И вы можете получить это даже в однострочном действии: [!d5 ]

sudo useradd -U -m -G <group> <user-name> && sudo passwd <user-name>
5
ответ дан 22 May 2018 в 17:00

Вы можете сделать это с помощью useradd. Я добавил строку, чтобы доказать, что это возможно. В этом случае passwd:

-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. -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. -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. -p, --password PASSWORD The encrypted password, as returned by crypt(3). The default is to disable the password. Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes. You should make sure the password respects the system's password policy. [!d]]

Итак, вам стоит сделать это в два этапа, таким образом, пароль не регистрируется системой.

sudo useradd -U -m -G <group> <user-name> sudo passwd <user-name>

И вы можете получить это даже в однострочном действии:

sudo useradd -U -m -G <group> <user-name> && sudo passwd <user-name>
5
ответ дан 18 July 2018 в 01:12

Вы можете сделать это с помощью useradd. Я добавил строку, чтобы доказать, что это возможно. В этом случае passwd:

-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. -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. -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. -p, --password PASSWORD The encrypted password, as returned by crypt(3). The default is to disable the password. Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes. You should make sure the password respects the system's password policy. [!d]]

Итак, вам стоит сделать это в два этапа, таким образом, пароль не регистрируется системой.

sudo useradd -U -m -G <group> <user-name> sudo passwd <user-name>

И вы можете получить это даже в однострочном действии:

sudo useradd -U -m -G <group> <user-name> && sudo passwd <user-name>
5
ответ дан 24 July 2018 в 17:21

Да, вы можете выполнить это с помощью одной команды, используя более дружественный интерфейс adduser вместо useradd.

sudo adduser --home /path/to/desired/homedirectory --ingroup specialgroup  newuser
8
ответ дан 22 May 2018 в 17:00

Да, вы можете выполнить это с помощью одной команды, используя более дружественный интерфейс adduser вместо useradd.

sudo adduser --home /path/to/desired/homedirectory --ingroup specialgroup newuser
8
ответ дан 18 July 2018 в 01:12

Да, вы можете выполнить это с помощью одной команды, используя более дружественный интерфейс adduser вместо useradd.

sudo adduser --home /path/to/desired/homedirectory --ingroup specialgroup newuser
8
ответ дан 24 July 2018 в 17:21

Другие вопросы по тегам:

Похожие вопросы: