Fedora 26
Sponsored Link

Add User Accounts2017/07/20

 
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 fedora --first=Fedora --last=Linux --password

Password:    
# set password

Enter Password again to verify:
-------------------
Added user "fedora"
-------------------
  User login: fedora
  First name: fedora
  Last name: Linux
  Full name: fedora Linux
  Display name: fedora Linux
  Initials: RL
  Home directory: /home/fedora
  GECOS: fedora Linux
  Login shell: /bin/bash
  Principal name: fedora@SRV.WORLD
  Principal alias: fedora@SRV.WORLD
  Email address: fedora@srv.world
  UID: 858000001
  GID: 858000001
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True

# verify registration

[root@dlp ~]#
ipa user-find fedora

--------------
1 user matched
--------------
  User login: fedora
  First name: fedora
  Last name: Linux
  Home directory: /home/fedora
  Login shell: /bin/bash
  Principal name: fedora@SRV.WORLD
  Principal alias: fedora@SRV.WORLD
  Email address: fedora@srv.world
  UID: 858000001
  GID: 858000001
  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

#!/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 "cent"
-----------------
  User login: cent
  First name: cent
  Last name: cent
  Full name: cent cent
  Display name: cent cent
  Initials: cc
  Home directory: /home/cent
  GECOS: cent cent
  Login shell: /bin/bash
  Principal name: cent@SRV.WORLD
  Principal alias: cent@SRV.WORLD
  Email address: cent@srv.world
  UID: 858000005
  GID: 858000005
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
.....
.....
Matched Content