NIS+NFS+Authconfig+Autofs实现自动挂载NIS用户宿主目录!
2014-04-08 15:05
513 查看
NIS服务配置请参考:NIS+NFS+Authconfig+Autofs实现自动挂载NIS用户宿主目录!
NFS及Autofs配置参考:RHCE课程--NFS服务 网络文件系统搭建攻略!
NFS和NIS的配置问题请参考上面的Blog,现在直接切入正题!
我们搭建完NIS服务器后可以为客户端提供统一的帐号和其它网络配置信息,但是如果我们使用NIS帐号登录客户端,系统会提示bash提示符,而没有其它环境信息提示:
一、在NIS服务器上共享NIS用户主目录
1.创建用户及NIS用户主目录
建议在NIS服务器上建立独立的目录存放NIS帐号信息,如果保持默认设置则客户端挂载NIS主目录到/home目录时会覆盖原有用户主目录而导致其他异常错误;我们现在建立/nishome存放NIS用户的主目录并使用useradd -d将NIS帐号的主目录指向/nishome,如果己有帐号可以使用usermod -d变更主目录。
# /usr/lib/yp/ypinit -m# service ypserv restart# service yppasswdd restart
3.共享用户主目录
1.检测主/从NIS服务器相应服务是否正常开启
执行setup(或者authconfig-tui命令)
3.修改Autofs主配置文件
# service autofs restart
可以看到重启Autofs服务后客户端自动创建了/nishome目录!
三、客户端测试
注意如果使用su命令在NIS客户端切换到NIS用户时,在第一次可能会报无法定位到用户家目录的错误,没有关系,退出第二次再使用时就会正常。
NFS及Autofs配置参考:RHCE课程--NFS服务 网络文件系统搭建攻略!
NFS和NIS的配置问题请参考上面的Blog,现在直接切入正题!
我们搭建完NIS服务器后可以为客户端提供统一的帐号和其它网络配置信息,但是如果我们使用NIS帐号登录客户端,系统会提示bash提示符,而没有其它环境信息提示:
Could not chdir to home directory /home/nisuser1: No such file or directory -bash-3.2$这是因为NIS帐号的主目录存放在NIS服务器上,而客户端虽然通过NIS服务器进行验证成功,但是客户端本地没有存放该用户的主目录信息,当根据NIS数据库提供的信息寻找用户主目录时将会提示错误哈~
一、在NIS服务器上共享NIS用户主目录
1.创建用户及NIS用户主目录
建议在NIS服务器上建立独立的目录存放NIS帐号信息,如果保持默认设置则客户端挂载NIS主目录到/home目录时会覆盖原有用户主目录而导致其他异常错误;我们现在建立/nishome存放NIS用户的主目录并使用useradd -d将NIS帐号的主目录指向/nishome,如果己有帐号可以使用usermod -d变更主目录。
[root@master /]# mkdir nishome [root@master /]# mkdir nishome/nisuser1 [root@master /]# usermod -d /nishome/nisuser1/ nisuser1 [root@master /]# useradd -d /nishome/nisuser2 nisuser2 [root@master /]# ls nishome/ nisuser1 nisuser22.重新生成NIS数据库并重启ypserv和yppasswd服务
# /usr/lib/yp/ypinit -m# service ypserv restart# service yppasswdd restart
3.共享用户主目录
# vim /etc/exports /nishome/nisuser1 *(rw) /nishome/nisuser2 *(rw)4.重启NFS服务
[root@master /]# service nfs restart Shutting down NFS mountd: [ OK ] Shutting down NFS daemon: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] Stopping RPC idmapd: [ OK ] Starting RPC idmapd: [ OK ]二、客户端配置NIS验证及Autofs
1.检测主/从NIS服务器相应服务是否正常开启
[root@client01 ~]# rpcinfo -p master.abcnis program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 952 status 100024 1 tcp 955 status 100004 2 udp 682 ypserv 100004 1 udp 682 ypserv 100004 2 tcp 685 ypserv 100004 1 tcp 685 ypserv 100009 1 udp 699 yppasswdd 100011 1 udp 781 rquotad 100011 2 udp 781 rquotad 100011 1 tcp 784 rquotad 100011 2 tcp 784 rquotad 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100021 1 udp 49642 nlockmgr 100021 3 udp 49642 nlockmgr 100021 4 udp 49642 nlockmgr 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100021 1 tcp 57392 nlockmgr 100021 3 tcp 57392 nlockmgr 100021 4 tcp 57392 nlockmgr 100005 1 udp 796 mountd 100005 1 tcp 799 mountd 100005 2 udp 796 mountd 100005 2 tcp 799 mountd 100005 3 udp 796 mountd 100005 3 tcp 799 mountd2.Authconfig启用NIS验证
执行setup(或者authconfig-tui命令)
3.修改Autofs主配置文件
vim /etc/auto.master # Sample auto.master file # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # For details of the format look at autofs(5). #/misc /etc/auto.misc # NOTE: mounts done from a hosts map will be mounted with the # "nosuid" and "nodev" options unless the "suid" and "dev" # options are explicitly given. # /net -hosts /nishome /etc/auto.nishome #nishome是客户端要挂载的目录;auto.nishome是Autofs客户端配置文件; # Include central master map if it can be found using # nsswitch sources. # Note that if there are entries for /net or /misc (as # above) in the included master map any keys that are th # same will not be seen as the first read key seen takes # precedence. +auto.master4.创建NIS自动挂载配置文件
[root@client01 ~]# touch /etc/auto.nishome [root@client01 ~]# vim /etc/auto.nishome * -fstype=nfs master.abcnis:/nishome/& # Autofs挂载目录支持通配符 * ; # 网络路径中的用户名使用 & 表示;5.重启Autofs服务
# service autofs restart
可以看到重启Autofs服务后客户端自动创建了/nishome目录!
三、客户端测试
注意如果使用su命令在NIS客户端切换到NIS用户时,在第一次可能会报无法定位到用户家目录的错误,没有关系,退出第二次再使用时就会正常。
[root@client01 ~]# su nisuser1 [nisuser1@client01 root]$ pwd /root [nisuser1@client01 root]$ cd [nisuser1@client01 nisuser1]$ pwd /nishome/nisuser1 [nisuser1@client01 nisuser1]$
相关文章推荐
- RHEL5.1NFS+NIS+Authconfig+Autofs实现自动挂载NIS用户主目录
- RHEL5.1NFS+NIS+Authconfig+Autofs实现自动挂载NIS用户主目录 推荐
- 搭建NIS+NFS服务器并实现autofs自动挂载
- Redhat7 autofs自动挂载nfs共享的home目录
- ldap网络账号和autofs自动挂载用户家目录服务
- autofs自动挂载NFS共享目录配置文档
- nis 用户家目录自动挂载
- autofs+nfs+nis实现智能挂载
- RHEL7 Autofs实现自动挂载文件
- 文件系统传输————NFS 自动挂载器————autofs
- 关于在开发板中实现NFS自动挂载的问题
- Ubuntu创建新用户及新用户NFS挂载远程目录权限问题
- 自动挂载NFS目录的两个办法
- 一键化部署rsync和nfs服务,挂载web服务器到nfs,实现共享目录和备份
- linux NIS与NFS及其自动挂载
- openldap服务器配置nfs共享,ldap用户挂载家目录
- 3种方式实现自动挂载samba共享目录
- (升级修改版1.1)集群配置(Torque安装配置+Maui安装配置+SSH免验证设置+节点共享目录(NFS服务)设置+NIS服务设置+用户硬盘空间限制和核心使用限制设置)异常详细版
- 实现NFS应用服务器、客户端autofs服务自动挂载器
- 问度娘关于autofs实现自动挂载iso的问题她不回答