Re: Добавление пользователей из фаила

Да совсем забыл дистр у меня Fedora Core 4

anonymous ()

Re: Добавление пользователей из фаила

cat users | awk '{print "useradd -m -s /bin/bash "$1}' | $SHELL

sdio ★★★★★ ()
Ответ на: Re: Добавление пользователей из фаила от drakon4ik

Re: Добавление пользователей из фаила

Создает список команд:

useradd -m -s /bin/bash user1
useradd -m -s /bin/bash user2
useradd -m -s /bin/bash user3

А $SHELL это команды исполняет

sdio ★★★★★ ()

Re: Добавление пользователей из фаила

зачем изобретать вилосипед

newusers - update and create new users in batch

newusers [new_users]

newusers reads a file of user name and cleartext password pairs and uses this
information to update a group of existing users or to create new users. Each
line is in the same format as the standard password file (see passwd(5)) with
the following exceptions.

pw_passwd This field will be encrypted and used as the new value of the
encrypted password.

pw_age This field will be ignored for shadow passwords if the user already

pw_gid This field may be the name of an existing group, in which case the
named user will be added as a member. If a non-existent numerical
group is given, a new group will be created having this number.

pw_dir This field will be checked for existence as a directory and a new
directory with the same name will be created if it does not already
exist. The ownership of the directory will be set to be that of the
user being created or updated.

This command is intended to be used in a large system environment where many
accounts are updated at a single time.

sova ★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.