Ubuntu Server Guide
Download 1.23 Mb. Pdf ko'rish
|
ubuntu-server-guide (1)
- Bu sahifa navigatsiya:
- User and Group Management - ldapscripts
References
• Replication types, OpenLDAP Administrator’s Guide • LDAP Sync Replication - OpenLDAP Administrator’s Guide • RFC 4533. LDAP Workstation Authentication Once you have a working LDAP server, you will need to install libraries on the client that will know how and when to contact it. On Ubuntu, this has been traditionally accomplished by installing the libnss-ldap package, but nowadays you should use SSSD. Please refer to Service - SSSD. User and Group Management - ldapscripts Another very common usage case for having an LDAP server is to store unix user and group information in the directory. There are many tools out there, but usually big deployments will have developed their own. Here we will briefly show how to use the ldapscripts package for an easy and quick way to start storing user and group information in OpenLDAP. Install the package: sudo apt i n s t a l l l d a p s c r i p t s Then edit the file /etc/ldapscripts/ldapscripts .conf to arrive at something similar to the following: SERVER=l d a p : / / l d a p 0 1 . example . com LDAPBINOPTS=”−ZZ” BINDDN=’ cn=admin , dc=example , dc=com ’ BINDPWDFILE=”/ e t c / l d a p s c r i p t s / l d a p s c r i p t s . passwd ” SUFFIX=’ dc=example , dc=com ’ GSUFFIX=’ou=Groups ’ USUFFIX=’ou=People ’ MSUFFIX=’ou=Computers ’ Note • Adjust SERVER and related SUFFIX options to suit your directory structure. • Note we are forcing START_TLS usage here (-ZZ parameter), please refer to LDAP with TLS for details on how to set the server up with TLS support 203 Store the cn=admin password in the /etc/ldapscripts/ldapscripts .passwd file and make sure it’s only read- able by the root local user: $ sudo chmod 400 / e t c / l d a p s c r i p t s / l d a p s c r i p t s . passwd The scripts are now ready to help manage your directory. Here are some examples of how to use them: • Create a new user: sudo ldapaddgroup g e o r g e sudo l d a p a d d u s e r g e o r g e g e o r g e This will create a group and user with name george and set the user’s primary group (gid) to george • Change a user’s password: $ sudo l d a p s e t p a s s w d g e o r g e Changing password f o r u s e r u i d=g e o r g e , ou=People , dc=example , dc=com New Password : Retype New Password : S u c c e s s f u l l y s e t password f o r u s e r u i d=g e o r g e , ou=People , dc=example , dc=com • Delete a user: sudo l d a p d e l e t e u s e r g e o r g e > ** Note ** > > This won ’ t d e l e t e t h e u s e r ’ s primary group , but w i l l remove t h e u s e r from supplementary o n e s . • Add a group: sudo ldapaddgroup qa • Delete a group: sudo l d a p d e l e t e g r o u p qa • Add a user to a group: sudo l d a p a d d u s e r t o g r o u p g e o r g e qa You should now see a memberUid attribute for the qa group with a value of george. • Remove a user from a group: sudo l d a p d e l e t e u s e r f r o m g r o u p g e o r g e qa The memberUid attribute should now be removed from the qa group. • The ldapmodifyuser script allows you to add, remove, or replace a user’s attributes. The script uses the same syntax as the ldapmodify utility. For example: sudo l d a p m o d i f y u s e r g e o r g e # About t o modify t h e f o l l o w i n g e n t r y : dn : u i d=g e o r g e , ou=People , dc=example , dc=com o b j e c t C l a s s : a c c o u n t o b j e c t C l a s s : p o s i xAc c o un t cn : g e o r g e u i d : g e o r g e 204 uidNumber : 10001 gidNumber : 10001 homeDirectory : /home/ g e o r g e l o g i n S h e l l : / b i n / bash g e c o s : g e o r g e d e s c r i p t i o n : User a c c o u n t userPassword : : e1NTSEF9eXFsTFcyWlhwWkF1eGUybVdFWHZKRzJVMjFTSG9vcHk= # Enter your m o d i f i c a t i o n s here , end with CTRL−D. dn : u i d=g e o r g e , ou=People , dc=example , dc=com r e p l a c e : g e c o s g e c o s : George C a r l i n The user’s gecos should now be “George Carlin”. • A nice feature of ldapscripts is the template system. Templates allow you to customize the attributes of user, group, and machine objects. For example, to enable the user template edit /etc/ldapscripts/ ldapscripts .conf changing: UTEMPLATE=”/ e t c / l d a p s c r i p t s / l d a p a d d u s e r . t e m p l a t e ” There are sample templates in the /usr/share/doc/ldapscripts/examples directory. Copy or rename the ldapadduser.template.sample file to /etc/ldapscripts/ldapadduser.template: sudo cp / u s r / s h a r e / doc / l d a p s c r i p t s / examples / l d a p a d d u s e r . t e m p l a t e . sample \ / e t c / l d a p s c r i p t s / l d a p a d d u s e r . t e m p l a t e Edit the new template to add the desired attributes. The following will create new users with an objectClass of inetOrgPerson: dn : u i d=,< u s u f f i x >,< s u f f i x > o b j e c t C l a s s : i n e t O r g P e r s o n o b j e c t C l a s s : p o s i xAc c o un t cn : sn : u i d : uidNumber : gidNumber : homeDirectory : l o g i n S h e l l : g e c o s : d e s c r i p t i o n : User a c c o u n t t i t l e : Employee Notice the value. There are utilities in the package that were not covered here. This command will output a list: dpkg −L l d a p s c r i p t s | g r e p / u s r / s b i n Download 1.23 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling