一点PHP博客分享关于如何在Ubuntu的服务器中设置sudo权限并安装ftp服务器,具体步骤如下:
设置sudo权限步骤:
1 |
sudo adduser username |
为普通用户添加sudo权限
sudo功能的配置文件一般在这里:/etc/sudoers
,可以使用gedit 编辑。然而/etc/sudoers的配置文件的注释里说明了,不建议直接修改/etc/sudoers,而是通过在/etc /sudoers.d/
文件夹中新增文件来完成配置。
1 |
Please consider adding local content in /etc/sudoers.d/ instead of directly modifying this file. |
新增的文件就用gedit编辑就可以了,比如说要为xxxx增加sudo权限,就增加一个文件,文件名无所谓,内容是:
1 |
xxxx_1 ALL=(ALL) ALL 保存,退出。 |
然后需要把这个文件权限设置为400:
1 |
chmod 400 xxxxx |
再用xxxxx用户登录后就可以使用sudo权限了。
Ubuntu16.04安装ftp服务器步骤:
1 |
sudo apt-get updatesudo apt-get install vsftpd |
修改ftp的配置文件 /etc/vsftpd.conf
1 2 3 4 5 6 7 8 |
(a)向文件中添加如下内容: userlist_deny=NO userlist_enable=YES #允许登录的用户 userlist_file=/etc/allowed_users seccomp_sandbox=NO local_enable=YES #设置文件上传 write_enable=YES #使用utf8utf8_filesystem=YES |
新建/etc/allowed_users文件
1 2 3 4 5 6 7 8 9 |
(b)新建/etc/allowed_users文件 sudo gedit /etc/allowed_users 假设我只想让xuanxufeng和root访问ftp服务器,那么输入xuanxufeng,root-->保存OK!以后还有其它用户使用ftp时直接添加用户名就可以了!(c)使用gedit查看/etc/ftpusers文件中的内容 sudo gedit /etc/ftpusers 打开这个文件后,看一看有没有uftp这个用户名,如果没有,就直接退出。如果有就删除uftp,因为这个文件中记录的是不能访问FTP服务器的用户清单。 重启vsftp服务器。 启动停止重启服务 sudo /etc/init.d/vsftpd startsudo /etc/init.d/vsftpd stopsudo /etc/init.d/vsftpd restart3. |
访问ftp服务器
sudo ftp 127.0.0.1浏览器访问
ftp://127.0.0.1 或者
ftp://localhost
远程访问时使用实际ip: ftp://your_ip
windows下简单有效地访问ftp服务器
1.在浏览器中输入ftp://xxx.xx.xx
2.使用文件传输软件(比如8uftp)
一点PHP,每天一点技术分享。