13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 2 ■ CENTRALIZING YOUR NETWORK: KERBEROS, LDAP, AND NFSYou can string as many of these together as you like. You can also specify which attributes should bereturned. The following would return all users with a login shell of zsh or bash but would return onlytheir uid and cn:ldapsearch "(|(loginShell=*bash)(loginShell=*zsh))" uid cnThe | character at the start of the filter specifies OR. You can list as many attributes at the end of theline as you want to return.ldapaddTo add an entry from the command line, you use the command ldapadd. This takes an LDIF file as anargument:ldapadd -f newuser.ldifThe LDIF file specifies the entry or entries to add. You can also do this on the command line, butyou can edit a file if you make a mistake when typing and can edit and reuse it if you need to add othersimilar entries. The following is a sample newuser.ldif file, which would create a user entry and an entryfor the autofs map for their home directory (see recipe 2-13):dn: uid=jkemp,ou=People,dc=example,dc=comuid: jkempobjectClass: accountobjectClass: posixAccountobjectClass: topobjectClass: shadowAccountloginShell: /bin/bashuidNumber: 439gidNumber: 1005homeDirectory: /home/jkempgecos: Juliet Kempcn: Juliet Kempdn: cn=jkemp,ou=auto.home,dc=example,dc=comobjectClass: automountcn: jkempautomountInformation: -fstype=nfs,rw server1:/export/home/jkempautomountMapName: auto_homeUse a blank line to separate entries in the LDIF file, as shown here.ldapmodifyTo modify an existing entry, use ldapmodify. Like ldapadd, the best way to use this is with an LDIF file asan argument:ldapmodify -f modify_file41Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!