2.识别共享服务器共享目录
smbclient -L //172.25.254.250
Enter root's password: 直接回车
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

        Sharename       Type      Comment
        ---------       ----      -------
        westos1         Disk      test share
        westos2         Disk      test share
        westos3         Disk      test share
        westos4         Disk      test share
        westos5         Disk      test share
        westos6         Disk      test share
        westos7         Disk      test share
        westos8         Disk      test share
        westos9         Disk      test share
        westos10        Disk      test share
        IPC$            IPC       IPC Service (Samba Server Version 4.1.1)
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

3.访问共享
命令访问)
smbclient //172.25.254.250/westos
Enter root's password:
挂载访问)
mount //172.25.254.250/westos /mnt  -o username=guest

4.开机自动挂载
方法一)
vim /etc/fstab
//172.25.254.250/westos /mnt cifs desfaults,username=guest 0 0

方法二)
vim /etc/rc.d/rc.local
mount //172.25.254.250/westos /mnt -o username=guest


nfs网络文件系统访问
1.安装访问共享文件
yum install nfs-utils -y

2.识别共享
mount 172.25.254.250:/nfsshare/nfs1 /mnt

3.自动挂载
方法一)
vim /etc/fstab
172.25.254.250:/nfsshare/nfs.1 /mnt nfs defaults  0 0

方法二)
vim /etc/rc.d/rc.local
mount 172.254.25.250:/nfsshare/nfs1 /mnt

chmod 755 /etc/rc.d/rc.local

autofs自动挂载服务
1.服务功能
使用mount挂载共享时当不使用时共享也会处于挂载状态浪费共享服务器资源
autofs可以实现当使用时自动挂载,闲置时自动卸载


2.安装服务
yum install autofs -y
systemctl start autofs

3.访问
cd   /net/172.25.254.250/nfsshare/nfs1

4.设定空闲卸载时间
vim /etc/autofs.conf
15 timeout = 3 (设置为3秒后系统自动卸载网络设备;默认为300)

5.实现自定义共享挂载点
vim /etc/auto.master
最终自定义挂载点的上层目录      子配置文件
13 /mnt    /etc/auto.nfs


vim子配置文件
最终挂载点                      网络共享目录
vim /etc/auto.nfs
pub1                    172.25.254.250:/nfsshare/nfs1
*                       172.25.254.250:/nfsshare/&      指定人以共享挂载点

systemctl  restart autofs                               重启服务



   ldap网络帐号
1.ldsp是什么
ldap目录服务认证和windows活动目录类似,就是记录数据的一种方式

2.ldap客户端所需软件
yum sssd krb5-workstation -y

3.如何开启ldap用户认证
authconfig-tui
mkdir /etc/openldap/cacerts
cd /etc/openldap/cacerts/
wget http://172.25.254.254/pub/example-ca.crt           获取证书

wKiom1gsTIzD3ylAAAN1sPNhrdQ221.png-wh_50

wKioL1gsTI6xdshFAAQw_p7KtvA017.png-wh_50

wKioL1gsTJHDNNHHAAXgksGTgF0629.png-wh_50

<测试>
getent passwd ldapuser1
如果显示用户信息正常显示,证明成功

列出所有用户
vim /etc/sssd/sssd.conf
enumrate = True                                         列出隐藏用户
systemctl restart sssd.service

自动挂载家目录
yum install autofs -y
vim /etc/auto.master
/home/guests   /ect/auto.ldap

vim /etc/auto.ldap
*               172.25.254.254:/home/guests/&

systemctl restart autofs
systemctl enable autofs


脚本方式
脚本内容)
#!/bin/bash
echo "install software ing .."
yum install sssd krb5-workstation autofs -y &> /dev/null

echo "config ldap auth client ing .."
authconfig \
--enableldap \
--enablekrb5 \
--disableldapauth \
--enableldaptls \
--ldaploadcacert=http://172.25.254.254/pub/example-ca.crt \
--ldapserver="cla***oom.example.com" \
--ldapbasedn="dc=example,dc=com" \
--krb5realm="EXAMPLE.COM" \
--krb5kdc="cla***oom.example.com" \
--krb5adminserver="cla***oom.example.com" \
--enablesssd \
--enablesssdauth \
--update


echo "config ldap user\'s home directory ing .."
echo /home/guests   /etc/auto.ldap >> /etc/auto.master
echo "*         172.25.254.254:/home/guests/&" >> /etc/auto.ldap
systemctl restart autofs
systemctl enable autofs &> /dev/null

echo " all is successfully"


9.ftp服务
2.安装
yum install vsftpd -y
systemctl start vsftpd
systemctl enable vsftpd
setenforce 0
lftp ip         登陆

[root@desktop25 ~]# firewall-cmd --permanent --add-service=ftp  使ftp添加进firewall,可以
执行
success
[root@desktop25 ~]# firewall-cmd --reload
success
[root@desktop25 ~]# firewall-cmd --list-all             列出可以通过的服务
public (default, active)
  interfaces: eth0
  sources:
  services: dhcpv6-client ftp ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

3.vsftpd文件信息
/var/ftp        默认发布目录
/etc/vsftpd     配置目录

chgrp ftp /var/ftp

chmod 775 /var/ftp


4.vsftpd服务的配置参数
1)匿名用户设定
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES | NO               你名用户登陆限制

<匿名用户上传>
vim /etc/vsftpd/vsftpd.conf
write_enable=YES
29 anon_upload_enable=YES

 anon_root=/directry                    匿名用户家目录修改
 anon_world_readable_only=NO |YES       匿名用户下载
 anon_mkdir_write_enable=YES | NO       匿名用户创建目录
 anon_other_write_enable=YES | NO       匿名用户删除
 anon_umask=xxx                         匿名用户上传文件默认权限修改

 anon_max_rate=102400            限速
 max_clients=1                   限制访问人数


2.本地用户设置
local_enable=YES                开启本地用户登陆
write_enable=YES                允许读写

本地用户家目录修改
local_root=/directory
本地用户上传文件权限
local_umask=xxx
《限制本地用户浏览/目录》
所有用户锁在自己的家目录
chroot_local_user=YES
chmod u-w /home/*               更改权限


用户黑名单
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

用户白名单
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

<限制本地登陆>
vim /etc/vsftpd/ftpusers
vim /etc/vsftpd/user_list

用户白名单设定
userlist_deny=NO
/etc/vsftpd/user_list           名单中用户可以登陆ftp

<虚拟用户创建>
vim /etc/vsftpd/userfile        创建虚拟用户文件
db_load -T -t hash -f /etc/vsftpd/userfile  /etc/vsftpd/userfile.db     加密
rm -rf /etc/vsftpd/userfile     删除原始文件

vim /etc/pam.d/asd            文件名任意

account                        required                    pam_userdb.so            db=/etc/vsftpd/userfile

auth                              required                    pam_userdb.so            db=/etc/vsftpd/userfile


vim /etc/vsftpd/vsftpd.conf

pam_service_name=ckvsftpd

guest_enable=YES


虚拟帐号身份指定)

guest_username=asd

chmod u-w /home/ftpuser


虚拟帐号家目录独立设定)

vim /etc/vsftpd/vsftpd.conf

local_root=/ftpuserhome/$USER

user_sub_tokrn=$USER


mkdir /ftpuserhome

chgrp ftpuser /ftpuserhome

chmod g+s /ftpusername