系统环境:Ubuntu 14.04

问题:普通用户使用 winscp 本地上传文件到系统里面去会报如下错误:

无权访问。

错误码:3

服务器返回的错误消息:Permission denied

wKiom1cpov_CW3oVAABIyH8E5iM556.png


这是因为要管理员权限的,而又不想给普通用户赋予管理员权限。所以这里开启root账号只用于上传文件。Ubuntu 默认是没有开启 root 账号的,并且我们提倡最好不要用 root 账号直接操作系统,开启 root 账号步骤如下:


1、首先设置 root 密码

luban@PDS-WEB:~$ sudo passwd root

[sudo] password for luban:                                    //输入当前普通用户的密码

Enter new UNIX password:                                    //给root设置密码

Retype new UNIX password:                                 //确认输入密码

passwd: password updated successfully


2、修改 /etc/ssh/sshd_config 文件

luban@PDS-WEB:~$ su - root

Password:

root@PDS-WEB:~# vi /etc/ssh/sshd_config      

# Authentication:

LoginGraceTime 120

#PermitRootLogin without-password

PermitRootLogin yes

StrictModes yes

说明:注释掉 “PermitRootLogin without-password”,添加 PermitRootLogin yes”


3、重启 ssh  服务

root@PDS-WEB:~# service ssh restart

ssh stop/waiting

ssh start/running, process 1335

root@PDS-WEB:~#


操作完成后就可以通过 root 账号登入 winscp 了。