AlmaLinux 9
Sponsored Link

FreeIPA : Add User Accounts2023/03/02

 
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 alma --first=AlmaLinux --last=Linux --password

Password:     # set password
Enter Password again to verify:
-----------------
Added user "alma"
-----------------
  User login: alma
  First name: AlmaLinux
  Last name: Linux
  Full name: AlmaLinux Linux
  Display name: AlmaLinux Linux
  Initials: AL
  Home directory: /home/alma
  GECOS: AlmaLinux Linux
  Login shell: /bin/sh
  Principal name: alma@IPA.SRV.WORLD
  Principal alias: alma@IPA.SRV.WORLD
  User password expiration: 20230302004349Z
  Email address: alma@ipa.srv.world
  UID: 895600003
  GID: 895600003
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True

# confirm

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

--------------
1 user matched
--------------
  User login: alma
  First name: AlmaLinux
  Last name: Linux
  Home directory: /home/alma
  Login shell: /bin/sh
  Principal name: alma@IPA.SRV.WORLD
  Principal alias: alma@IPA.SRV.WORLD
  Email address: alma@ipa.srv.world
  UID: 895600003
  GID: 895600003
  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 "redhat"
-------------------
  User login: redhat
  First name: redhat
  Last name: redhat
  Full name: redhat redhat
  Display name: redhat redhat
  Initials: rr
  Home directory: /home/redhat
  GECOS: redhat redhat
  Login shell: /bin/sh
  Principal name: redhat@IPA.SRV.WORLD
  Principal alias: redhat@IPA.SRV.WORLD
  User password expiration: 20220323004003Z
  Email address: redhat@ipa.srv.world
  UID: 374000005
  GID: 374000005
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
.....
.....
Matched Content