Tag Info

Hot answers tagged

7

There's an app for that! The newusers tool which is part of the passwd package is designed to batch create users: DESCRIPTION The newusers command reads a file (or the standard input by default) and uses this information to update a set of existing users or to create new users. Each line is in the same format as the standard password file (see ...


5

With a script you can. This needs a file with user and password commaseparated: while IFS="," read -r user passwd ; do echo "useradd -m -p $(mkpasswd "$passwd") $user" done < /home/$USER/Downloads/users.txt mkpasswd can be installed with sudo apt-get install whois Change the , to a ; if you need that. Save this as users.sh and set ...


5

cp has an option to specify the target directory separately: -t. So you can do: for u in /home/* do sudo cp -t "$u/.config/autostart" -i <file> sudo mkdir "$u/Desktop/foo" done In general, there's no simple way to manage user's home directories. You can specify what gets created in it when the home directory is first created, but after that, ...


4

There are two parts to this question: Creating a user without admin privileges Creating a user who's a clone of another Typically, an admin user on Ubuntu is an admin because they are in the sudo group. Membership in sudo gives you both sudoers and Polkit privileges by the default configuration: $ grep %sudo /etc/sudoers %sudo ALL=(ALL:ALL) ALL $ grep ...


4

Here is an awk one-liner: sudo awk -F',' '{ command="useradd -p $( mkpasswd "$2" ) "$1;print command; system(command) }' userlist.txt Or for readability, here's the format: sudo awk -F',' '{ command="useradd -p $(mkpasswd "$2 ")" $1; print command; system(command) }' userlist.txt Explanation: awk's ...


3

I have a shorter awk version (@Serg =)): First install whois, we need the command mkpasswd sudo apt-get install whois Than you can use this oneliner: awk -F',' '{print "Create user: "$1; system("sudo useradd -p $(mkpasswd "$2") "$1)}' users or without any output: awk -F',' '{system("sudo useradd -p $(mkpasswd "$2") "$1)}' users Content of users: ...


2

My AWK version has a problem with , in the password. Here is my perl version: #!/usr/bin/perl use strict; use warnings; use Text::CSV; my $file = $ARGV[0]; open my $fh, "<", $file or die "$file: $!"; my $csv = Text::CSV->new ({ binary => 1, # Allow special character. Always set this auto_diag => 1, # Report irregularities ...


2

Here is a python solution: #!/usr/bin/env python2 import subprocess, crypt with open('/path/to/file.csv') as f: for line in f: i = line.find(',') name = line[:i] password = line.rstrip()[i+1:] encpt_passwd = crypt.crypt(password, '2b') command = 'useradd -m -p {0} {1}'.format(encpt_passwd, name).split() ...


2

useradd / usermod command have an option to specify the primary group( -g). If you create a user without -g option a primarygroup will be created with the same name as the new username and the new user will be added to this group. When user creates a file/directory it gets the group of user's primary group. You can have only one primary group assigned to a ...


2

Create a new user. Execute the following command: cp --no-dereference --recursive --preserve=timestamps, /home/old_user/* /home/new_user/ Delete the data files from old_user that you now don't need any more (documents, pictures, …)


1

I'm going to assume you installed wine via apt-get from the typical repositories or that you added a ppa for wine and installed it from there or generally just have wine installed such that any user can run it. If you have some other setup, add a comment and I'll update my post. So, here's what needs to be done: You need to put the files somewhere that ...


1

You can use passwd command: sudo passwd username you'll prompt for password enter it then you'll be prompt to enter new password for that user sudo passwd test [sudo] password for test: Enter new UNIX password: Retype new UNIX password: man passwd DESCRIPTION The passwd command changes passwords for user accounts. A normal user may ...


1

Add the below entry in /etc/login.defs and save: CREATE_HOME yes Now, try to create user accounts. It will create the home directory.


1

Hide a specific user by creating a file in /var/lib/AccountsService/users/ named with the username, in this case: postgres. $ sudo vim /var/lib/AccountsService/users/postgres And add the following two lines: [User] SystemAccount=true If it happens that your system dosen't use AccountsService then hide the user by editing the /etc/lightdm/users.conf ...



Only top voted, non community-wiki answers of a minimum length are eligible