简单LAMP、SQL语句、文件共享服务介绍

1、搭建php-fpm工作方式的LAMP环境,实现wordpress正常访问

在CentOS7上安装httpd-2.4版本默认是支持fastcgi模块的,php-fpm包专用于将php运行于fpm模式;

环境规划:CentOS7,httpd-2.4,php-fpm,php-mysql,php-mbstring,mairadb-server,wordpress文件包。

[root@yuanchao ~]# yum info php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Available Packages
Name        : php-fpm
Arch        : x86_64
Version     : 5.4.16
Release     : 45.el7
Size        : 1.4 M
Repo        : base/7/x86_64
Summary     : PHP FastCGI Process Manager
URL         : http://www.php.net/
License     : PHP and Zend and BSD
Description : PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
            : implementation with some additional features useful for sites of
            : any size, especially busier sites.

这里我们先从后端往前安装,首先下载wordpress文件包,安装mysql数据库,创建wordpress库,授权用户等操作;

[root@localhost ~]# ls
anaconda-ks.cfg  wordpress-4.9.4-zh_CN.tar.gz
[root@localhost ~]# yum info mariadb-server
[root@localhost ~]# yum install mariadb-server -y

这里我们安装完后,mysql是可以直接登录的,是不安全的,我们可以进行安全加固配置,再约定俗成的在/etc/my.cnf.d/server.cnf文件里如下几行信息:

# this is only for the mysqld standalone daemon
[mysqld]
skip_name_resolve=ON
innodb_file_per_table=ON

再进行mysql安全加固:

[root@localhost ~]# mysql_secure_installation 

通过root用户登录,创建wordpress库,授权一个用户对wordpress库里的表有权限。

[root@localhost ~]# mysql -uroot -h127.0.0.1 -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| wordpress          |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> GRANT ALL ON wordpress.* TO 'tom'@'10.9.3.246' IDENTIFIED BY 'redhat';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> 

可以退出mysql后,测试一下授权的用户是否成功。接下来安装php-fpm包和其他的php连接数据库相关模块,如果有报错时,缺少什么再安装什么包即可;

[root@localhost ~]# yum install php-fpm php-mysql php-mbstring php-mcrypt -y

安装完成后,简单修改下/etc/php-fpm.d/www.conf这个文件。

listen = 127.0.0.1:9000 这里是在一台主机安装LAMP环境,可指向本机,如动态页面部署在其他主机,这里的127地址要指向动态页面组件的地址,如jdk,tomcat服务;
...
listen.allowed_clients = 127.0.0.1
...
pm.status_path = /status 可以查看php-fpm状态
...
ping.path = /ping 监测php-fpm状态页面
ping.response = pong
...
; Set session path to a directory owned by process user 这里创建session目录,用于保持session会话;注意属主属组要指向apache用户和组,注意路径;
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
[root@localhost ~]# mkdir /var/lib/php/session -pv
mkdir: created directory ‘/var/lib/php/session’
[root@localhost ~]# chown apache.apache /var/lib/php/session/

之后就可以启动php-fpm服务了,注意端口为9000;

[root@localhost ~]# systemctl start php-fpm
[root@localhost ~]# ss -tnl
State      Recv-Q Send-Q     Local Address:Port                    Peer Address:Port              
LISTEN     0      128                    *:22                                 *:*                  
LISTEN     0      100            127.0.0.1:25                                 *:*                  
LISTEN     0      128            127.0.0.1:9000                               *:*                  
LISTEN     0      50                     *:3306                               *:*                  
LISTEN     0      128                   :::22                                :::*                  
LISTEN     0      100                  ::1:25                                :::*                  
[root@localhost ~]# 

安装httpd-2.4,确保要有fastcgi这个模块;

[root@localhost ~]# yum install httpd -y
[root@localhost ~]# httpd -M | grep fcgi
 proxy_fcgi_module (shared)
[root@localhost ~]# 

这里就可以把wordpress文件包放在httpd的默认根目录下,或者自己指定的目录,但需要修改配置文件;

[root@localhost ~]# cp wordpress /var/www/html/ -r
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ls
wordpress
[root@localhost html]# ln -sv wordpress/ wp 如果觉得目录名过长,建议创建符号链接;
‘wp’ -> ‘wordpress/’
[root@localhost html]# ll
total 4
drwxr-xr-x. 5 root root 4096 Sep 26 15:10 wordpress
lrwxrwxrwx. 1 root root   10 Sep 26 15:11 wp -> wordpress/
[root@localhost html]# 

进wordpress目录下修改下配置文件;

[root@localhost wordpress]# cp wp-config-sample.php wp-config.php 
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');

/** MySQL数据库用户名 */
define('DB_USER', 'tom');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'redhat');

/** MySQL主机 */
define('DB_HOST', '10.9.3.246');

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');

#以上几项是之前创建mysql的wordpress库的内容,和授权的用户信息等,要保持一致;

这里wordpress配置就完了,开始配置httpd,可以创建个虚拟主机配置文件,放在/etc/httpd/conf.d/。创建个index.php测试页,测试下php-fpm是否正常运行,我这里用的phpinfo这个内置函数来测试;

[root@localhost html]# cat index.php 
<?php
	phpinfo();
?>
[root@localhost html]# 

访问地址看下是否成功;

这里显示后台运行的FPM模块即可;再配置虚拟主机文件,或者直接创建个配置文件,不用虚拟主机也可以,将用户请求代理到后端用fcgi来响应请求;

DirectoryIndex index.php 设置默认访问主页;

<VirtualHost *:80> 监听所有地址的80端口;
        ServerName www.ilinux.io 虚拟主机名;如果基于主机访问,注意要修改hosts文件;
        DocumentRoot /var/www/html 根目录路径,我这里用的是默认的,也可以改为其他的路径,一般默认可以是存储设备;
        ProxyRequests Off 关闭正向代理;
        ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1 正则模式匹配到的前面任意长度任意字符以.php结尾的请求,都代理到后端的这个目录下,我这里是在同一个主机;

        <Directory "/var/www/html"> 这里是授权根目录;
                Options FollowSymLinks 这里之前是None,但我们创建的是符号链接访问,所以这里要改为FollowSymLinks;
                AllowOverride None
                Require all granted
        </Directory>
</VirtualHost>

至此,我们的httpd配置完成了,重启服务,访问下wp这个uri看是否可以访问wordpress。

这里就完成了wordpress用php-fpm搭建LAMP环境。

2、什么是DML?常用SQL举例,每个命令至少1个例子,最多不超过3个例子

DDL是mysql数据库服务器端命令的一种语言类型,表示数据定义语言,主要用于管理数据库组件,例如数据库,表,索引,视图,用户,存储过程等;常用命令有CREATE,ALTER,DROP等;

DML也是mysql数据库服务器端命令的一种语言类型,表示数据操纵语言,主要用于管理表中的数据,实现数据的增删改查等功能,常用命令有INSERT,DELETE,UPDATE,SELECT等;

我这里是先创建个test库,在库里创建表,完成增删改查等操纵;

MariaDB [(none)]> CREATE DATABASE test; #创建一个test库;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> USE test; #使用test库;
Database changed
MariaDB [test]> 
MariaDB [test]> CREATE TABLE users(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,name CHAR(50) BINARY NOT NULL,password CHAR(48) BINARY NOT NULL);
#在test库里创建一个表,users,定义三个字段,id,name,password,其中id字段键入自动增长属性,不为空,主键;name字段字符长度为50个字节,不为空;password字段一样,48个定长字节,因为键入内容的时候调用mysql的password函数存放加密的密码为48位。
Query OK, 0 rows affected (0.33 sec)

MariaDB [test]> DESC users; #查看表结构;
+----------+----------+------+-----+---------+----------------+
| Field    | Type     | Null | Key | Default | Extra          |
+----------+----------+------+-----+---------+----------------+
| id       | int(11)  | NO   | PRI | NULL    | auto_increment |
| name     | char(50) | NO   |     | NULL    |                |
| password | char(48) | NO   |     | NULL    |                |
+----------+----------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

MariaDB [test]> 
MariaDB [test]> INSERT INTO users(name,password) VALUE('tom',password('redhat'));
#插入表内容,第一个括号里面跟要插入的字段,用逗号隔开;VALUE后的括号表示字段内定义的内容,用‘’引用,逗号隔开,password()这个是mysql内置的函数,对括号里面的内容进行加密存放;
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> INSERT INTO users(name,password) VALUE('jerry',password('jerry'));
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> SELECT * FROM users; #查看表内容,*表示FROM后面跟的表名称里的所有内容;
+----+-------+-------------------------------------------+
| id | name  | password                                  |
+----+-------+-------------------------------------------+
|  1 | tom   | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
|  2 | jerry | *09FB9E6E2AA0750E9D8A8D22B6AA8D86C85BF3D0 |
+----+-------+-------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [test]> 

3、简述ftp的主动和被动模式,并实现基于pam认证的vsftpd

FTP是文件传输协议,在Linux系统中是vsftpd服务,提供文件共享服务,上传下载功能,其中有两种连接,命令连接和数据连接,C/S架构,服务端开放ftp固定端口21,当然也可以更改,客户端建立TCP三次握手连接,完成第一步命令连接,在数据传输连接上有主动和被动两种模式,其区别在于发起数据传输方端口的变化上,可根据流程图进行理解。

主动模式(PORT)是由服务器端主动发起数据传输连接请求,在20号端口向客户端TCP连接的端口上加1,如果得出结果的端口被占用,那么会继续往后加1,直到没有被使用,从而建立数据传输连接,这就是FTP的主动模式;

被动模式(PASV)是由客户端发起的数据请求,服务端会给客户端两个数字组合,其客户端会按照X*256+Y的公式计算出需要请求的端口,从而进行数据传输连接,这就是FTP的被动模式。

建立vsftpd服务基于pam模块认证mysql数据库用户,这是基于vsftpd服务端本地用户映射虚拟用户登录访问ftp的机制,这样保证了系统服务的安全,不会因为虚拟用户的泄露问题而导致服务器的被控制。

环境规划:CentOS 7,vsftpd服务器,本地用户vuser,mysql授权查询权限,vsftpd用户,vsftpd数据库,users表,tom和jerry两个虚拟用户,都有上传下载权限,但jerry无创建目录和写权限,这里需要用到vsftpd包,mysql,pam_mysql包需要编译安装。

[root@yuanchao ~]# yum install mariadb-server -y
[root@yuanchao ~]# systemctl start mariadb
[root@yuanchao ~]# ss -tnl
State       Recv-Q Send-Q     Local Address:Port                    Peer Address:Port              
LISTEN      0      128                    *:22                                 *:*                  
LISTEN      0      100            127.0.0.1:25                                 *:*                  
LISTEN      0      128            127.0.0.1:6010                               *:*                  
LISTEN      0      50                     *:3306                               *:*                  
LISTEN      0      128                   :::22                                :::*                  
LISTEN      0      100                  ::1:25                                :::*                  
LISTEN      0      128                  ::1:6010                              :::*     

先安装mysql数据库,然后启动,创建库,表,插入用户密码,授权用户,测试是否成功,我的mysql是和vsftpd同一台主机;

MariaDB [(none)]> CREATE DATABASE vsftpd;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> USE vsftpd;
Database changed
MariaDB [vsftpd]> CREATE TABLE users(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,name CHAR(50) BINARY NOT NULL,password CHAR(48) BINARY NOT NULL);
Query OK, 0 rows affected (0.01 sec)

MariaDB [vsftpd]> DESC users;
+----------+----------+------+-----+---------+----------------+
| Field    | Type     | Null | Key | Default | Extra          |
+----------+----------+------+-----+---------+----------------+
| id       | int(11)  | NO   | PRI | NULL    | auto_increment |
| name     | char(50) | NO   |     | NULL    |                |
| password | char(48) | NO   |     | NULL    |                |
+----------+----------+------+-----+---------+----------------+
3 rows in set (0.02 sec)

MariaDB [vsftpd]> INSERT INTO users(name,password) VALUE('tom',password('redhat'));
Query OK, 1 row affected (0.01 sec)

MariaDB [vsftpd]> INSERT INTO users(name,password) VALUE('jerry',password('jerry'));
Query OK, 1 row affected (0.01 sec)

MariaDB [vsftpd]> SELECT * FROM users;
+----+-------+-------------------------------------------+
| id | name  | password                                  |
+----+-------+-------------------------------------------+
|  1 | tom   | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
|  2 | jerry | *09FB9E6E2AA0750E9D8A8D22B6AA8D86C85BF3D0 |
+----+-------+-------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [vsftpd]> GRANT SELECT ON vsftpd.* TO 'vsftpd'@'127.0.0.1' IDENTIFIED BY 'redhat';
Query OK, 0 rows affected (0.02 sec)

MariaDB [vsftpd]> GRANT SELECT ON vsftpd.* TO 'vsftpd'@'localhost' IDENTIFIED BY 'redhat';
Query OK, 0 rows affected (0.01 sec)

MariaDB [vsftpd]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [vsftpd]> 

这里的操作就不做过多解释了,上面的第二题有说明;

[root@yuanchao ~]# mysql -uvsftpd -h127.0.0.1 -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> USE vsftpd;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [vsftpd]> SELECT * FROM users;
+----+-------+-------------------------------------------+
| id | name  | password                                  |
+----+-------+-------------------------------------------+
|  1 | tom   | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
|  2 | jerry | *09FB9E6E2AA0750E9D8A8D22B6AA8D86C85BF3D0 |
+----+-------+-------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [vsftpd]> 

测试没有问题,开始安装vsftpd服务和编译pam_mysql包;

[root@yuanchao ~]# yum install mariadb-devel pam-devel openssl-devel -y
[root@yuanchao pam_mysql-0.7RC1]# ./configure --with-mysql=/usr/ --with-openssl=/usr/ --with-pam=/usr/ --with-pam-mods-dir=/usr/lib64/security/
[root@yuanchao pam_mysql-0.7RC1]# make && make install
[root@yuanchao pam_mysql-0.7RC1]# cd /usr/lib64/security/
[root@yuanchao security]# ls
...
pam_mysql.so
... 
[root@yuanchao security]# 
[root@yuanchao ~]# yum install vsftpd -y #安装vsftpd服务
[root@yuanchao ~]# mkdir /ftproot/vuser -pv #创建一个本地用户的家目录
mkdir: created directory ‘/ftproot’
mkdir: created directory ‘/ftproot/vuser’
[root@yuanchao ~]# useradd -s /sbin/nologin -d /ftproot/vuser/ vuser #创建一个本地用户
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
[root@yuanchao ~]# chmod u-w /ftproot/vuser/ #需要把用户家目录的写权限取消
[root@yuanchao ~]# 
[root@yuanchao ~]# cd /etc/pam.d/
[root@yuanchao pam.d]# vim vsftpd.mysql
[root@yuanchao pam.d]# cat vsftpd.mysql 
auth required /usr/lib64/security/pam_mysql.so user=vsftpd passwd=redhat host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2

account required /usr/lib64/security/pam_mysql.so user=vsftpd passwd=redhat host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2
[root@yuanchao pam.d]#
[root@yuanchao pam.d]# vim /etc/vsftpd/vsftpd.conf #修改一下vsftpd的配置文件
anonymous_enable=NO #禁止匿名用户登录
pam_service_name=vsftpd.mysql #指定pam服务认证的文件是我们刚才添加的
guest_enable=YES #允许来宾用户登录
guest_username=vuser #指定来宾用户为vuser
[root@yuanchao pam.d]# systemctl start vsftpd #启动vsftpd服务
[root@yuanchao pam.d]# ss -tnl
State       Recv-Q Send-Q                                 Local Address:Port                                                Peer Address:Port              
LISTEN      0      128                                                *:22                                                             *:*                  
LISTEN      0      100                                        127.0.0.1:25                                                             *:*                  
LISTEN      0      128                                        127.0.0.1:6010                                                           *:*                  
LISTEN      0      50                                                 *:3306                                                           *:*                  
LISTEN      0      32                                                :::21                                                            :::*                  
LISTEN      0      128                                               :::22                                                            :::*                  
LISTEN      0      100                                              ::1:25                                                            :::*                  
LISTEN      0      128                                              ::1:6010                                                          :::*                  
[root@yuanchao pam.d]# 
[root@localhost ~]# ftp 10.9.3.244
Connected to 10.9.3.244 (10.9.3.244).
220 (vsFTPd 3.0.2)
Name (10.9.3.244:root): tom
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.
[root@localhost ~]# ftp 10.9.3.244
Connected to 10.9.3.244 (10.9.3.244).
220 (vsFTPd 3.0.2)
Name (10.9.3.244:root): jerry
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.
[root@localhost ~]# 

4、简述NFS服务原理及配置

NFS是Linux系统平台之间的网络文件共享服务,经过NFS版本的几代更迭,现已支持TCP服务,监听在2049端口上。可以在一台主机上搭建NFS服务,另一台主机或者更多主机作为客户端远程挂载NFS服务端的文件系统,来实现网络文件共享服务。这就需要有rpc远程系统调用服务,rpc.mountd完成认证服务,rpc.lockd完成加锁服务,rpc.statd完成状态查看服务等。服务端用到nfs-utils软件包,系统一般安装时加载nfs模块,通过/etc/exports文件对或/etc/exprots.d/下的文件完成对本地磁盘内容实现网络输出的功能;客户端通过mount -t nfs servername:/path/to/share /path/to/mount_point  [-rvVwfnsh ] [-o options]实现挂载访问。

[root@yuanchao ~]# yum info nfs-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: mirrors.huaweicloud.com
Available Packages
Name        : nfs-utils
Arch        : x86_64
Epoch       : 1
Version     : 1.3.0
Release     : 0.54.el7
Size        : 407 k
Repo        : base/7/x86_64
Summary     : NFS utilities and supporting clients and daemons for the kernel NFS server
URL         : http://sourceforge.net/projects/nfs
License     : MIT and GPLv2 and GPLv2+ and BSD
Description : The nfs-utils package provides a daemon for the kernel NFS server and
            : related tools, which provides a much higher level of performance than the
            : traditional Linux NFS server used by most users.
            : 
            : This package also contains the showmount program.  Showmount queries the
            : mount daemon on a remote host for information about the NFS (Network File
            : System) server on the remote host.  For example, showmount can display the
            : clients which are mounted on that host.
            : 
            : This package also contains the mount.nfs and umount.nfs program.

SRV1和SRV2,NFS Server都安装nfs-utils软件包;

[root@yuanchao ~]# mkdir -pv /data/mysql/test
mkdir: created directory ‘/data’
mkdir: created directory ‘/data/mysql’
mkdir: created directory ‘/data/mysql/test’
[root@yuanchao ~]# cp /etc/issue /data/mysql/test/
[root@yuanchao ~]# vim /etc/exports
[root@yuanchao ~]# cat /etc/exports
/data/mysql/test	10.9.3.245(ro)
[root@yuanchao ~]# 

切换到SRV1上进行挂载使用;

[root@localhost ~]# mount -t nfs 10.9.3.244:/data/mysql/test /mnt -o ro
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls
issue
[root@localhost mnt]# cat issue 
Welcome!
[root@localhost mnt]# 

5、简述samba服务,并实现samba配置

samba服务是实现跨平台文件共享服务,它可以实现Linux与Windows系统之间传输文件,共享文件等服务,属于CIFS文件系统,通用互联网文件系统,其功能有文件系统共享,打印机共享,使用NetBIOS协议,服务端程序包有samba,samba-common,samba-libs等,客户端安装samba-client软件包,使用smbclient命令实现文件共享,类似于lftp,可用mount.cifs挂载目录使用,使用samba服务自我管理的账号和密码进行用户认证,用户必须是系统用户,但密码非为/etc/shadow中的密码,而由samba自行管理的文件,其密码文件的格式由passdb backend进行定义;

samba用户管理:smbpasswd命令;

smbpasswd [options] USERNAME

-a:添加

-x:删除

-d:禁用

-e:启用

pdbedit

-L:列出samba服务中的所有用户;

-a, --create:添加用户为samba用户;

-u, --user=USER:要管理的用户;

-x, --delete:删除用户;

-t, --password-from-stdin:从标准输出接收字符串作为用户密码;使用空提示符,而后将密码输入两次;

查看服务器端的共享:

smbclient -L SMB_SERVER  [-U USERNAME]

交互式文件访问:

smbclient //SMB_SERVER/SHARE_NAME [-U USERNAME]

挂载访问:

mount -t cifs //SMB_SERVER/SAHRE_NAME  -o username=USERNAME,password=PASSWORD

注意:挂载操作的用户,与-o选项中指定用户直接产生映射关系;此时,访问挂载点,是以-o选项中的username指定的用户身份进行;本地用户对指定的路径访问,首先得拥有对应的本地文件系统权限;

smbstatus命令:显示samba服务的相关共享的访问状态信息;

-b:显示简要格式信息;

-v:显示详细格式信息;

[root@localhost ~]# smbclient -L 10.9.3.244
Enter SAMBA\root's password: 
Anonymous login successful

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.7.1)
Reconnecting with SMB1 for workgroup listing.
Anonymous login successful

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

	Workgroup            Master
	---------            -------
	SAMBA                YUANCHAO
	WORKGROUP            GZWX-VIRTUAL-MAC
[root@localhost ~]# 
[root@localhost ~]# 
[root@yuanchao samba]# grep -E -i "#(====| ----)" smb.conf.example 
#======================= Global Settings =====================================
# ----------------------- Network-Related Options -------------------------
# --------------------------- Logging Options -----------------------------
# ----------------------- Standalone Server Options ------------------------
# ----------------------- Domain Members Options ------------------------
# ----------------------- Domain Controller Options ------------------------
# ----------------------- Browser Control Options ----------------------------
# --------------------------- Printing Options -----------------------------
# --------------------------- File System Options ---------------------------
#============================ Share Definitions ==============================
[root@yuanchao samba]# smbstatus -v
using configfile = /etc/samba/smb.conf

Samba version 4.7.1
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------

No locked files

[root@yuanchao samba]# 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值