Ubuntu 18.04
Sponsored Link

FreeIPA : Add User Accounts
2018/11/27
 
Add User Accounts on FreeIPA Server.
[1] Add a user. The password set on here is required to change at initial login.
root@dlp:~#
ipa user-add ubuntu --first=Ubuntu --last=Linux --password

Password:    
# set password

-------------------
Added user "ubuntu"
-------------------
  User login: ubuntu
  First name: Ubuntu
  Last name: Linux
  Full name: Ubuntu Linux
  Display name: Ubuntu Linux
  Initials: UL
  Home directory: /home/ubuntu
  GECOS: Ubuntu Linux
  Login shell: /bin/bash
  Principal name: ubuntu@IPA.SRV.WORLD
  Principal alias: ubuntu@IPA.SRV.WORLD
  User password expiration: 20181126051246Z
  Email address: ubuntu@ipa.srv.world
  UID: 1389200001
  GID: 1389200001
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True

# verify registration

root@dlp:~#
ipa user-find ubuntu

--------------
1 user matched
--------------
  User login: ubuntu
  First name: Ubuntu
  Last name: Linux
  Home directory: /home/ubuntu
  Login shell: /bin/bash
  Principal name: ubuntu@IPA.SRV.WORLD
  Principal alias: ubuntu@IPA.SRV.WORLD
  Email address: ubuntu@ipa.srv.world
  UID: 1389200001
  GID: 1389200001
  Account disabled: False
----------------------------
Number of entries returned 1
----------------------------
[2] Add Existing local Users to FreeIPA Directory.
( set the same password with the username on this example, but it is required to change at initial login )
root@dlp:~#
vi ipauser.sh
# extract local users who have 1000-9999 digit UID
# this is an example, free to modify

#!/bin/bash

for line in `grep "x:[1-9][0-9][0-9][0-9]:" /etc/passwd`
do
   USER=`echo $line | cut -d: -f1`
   FIRST=`echo $line | cut -d: -f5 | awk {'print $1'}`
   LAST=`echo $line | cut -d: -f5 | awk {'print $2'}`

   [ ! "$FIRST" ] && FIRST=$USER
   [ ! "$LAST" ] && LAST=$USER

   echo $USER | ipa user-add $USER --first=$FIRST --last=$LAST --password
done
root@dlp:~#
sh ipauser.sh

-------------------
Added user "debian"
-------------------
  User login: debian
  First name: ,,,
  Last name: debian
  Full name: ,,, debian
  Display name: ,,, debian
  Initials: ,d
  Home directory: /home/debian
  GECOS: ,,, debian
  Login shell: /bin/bash
  Principal name: debian@IPA.SRV.WORLD
  Principal alias: debian@IPA.SRV.WORLD
  User password expiration: 20181126051447Z
  Email address: debian@ipa.srv.world
  UID: 1389200003
  GID: 1389200003
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
.....
.....
Matched Content
 
Tweet