linux - proftpd sftp CentOS 权限被拒绝

标签 linux permissions centos sftp proftpd

我想在 CentOs 上配置服务器 SFTP。我已经在 Ubuntu 服务器上进行了测试,它运行良好!

看来用户和服务器的位置很重要。

我在 / 和用户 bob 中创建了一个文件夹 /sftp :

mkdir /sftp
chmod 777 /sftp
adduser --home /sftp bob

当我将 bob 连接到 sftp 服务器并使用 ls 时,我收到消息“permission denied”:

sftp -P 2222 bob@x.x.x.x 
sftp>ls
remote readdir("/") : Permission denied

但是要知道,如果我在 /etc/passwd 中更改用户 bob 的位置,它就会起作用!

chmod 777 /etc
nano /etc/passwd
bob:x:5000:99::/sftp:/bin/bash ---> bob:x:5000:99::/etc:/bin/bash
service proftpd restart

# On client
sftp -P 2222 bob@x.x.x.x 
sftp>ls
files ...

所以我无法在 /etc 之外创建我的服务器,为什么?我已经在不同版本的 proftpd 上进行了测试。

因为我注意到在我的 Ubuntu 服务器上工作正常,如果我将 /sftp 放在 /etc 中,put 命令就会出现问题,但如果我将 /sftp 放在根“put”中,效果很好。

我的文件 proftpd.conf 是基本配置:

## basic config ...

SFTPEngine         on
Port               2222

SFTPLog            /var/log/proftpd/sftp.log
TransferLog        /var/log/proftpd/sftp-xferlog

# Host Keys
SFTPHostKey        /etc/ssh/ssh_host_rsa_key
SFTPHostKey        /etc/ssh/ssh_host_dsa_key

# Auth methods
SFTPAuthMethods    password
AuthUserFile       /etc/proftpd/sftp.passwd

# SFTP specific configuration
DefaultRoot        ~

最佳答案

已找到解决方案! CentOS 的安全服务限制了对某些目录的访问。所以只是禁用。

nano  /etc/selinux/config
SELINUX=disabled
#reboot system

关于linux - proftpd sftp CentOS 权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23386335/

相关文章:

grails - grails 中的访问控制、角色和权限

linux - 使用 "cat > text.txt"写入文本文件时如何退格?

python - 我如何在 python 中连接到 Microsoft sql server 2008

android - Activity.requestPermissions 与 ActivityCompat.requestPermissions

c# - 如何使用用户权限而不是事件权限启动程序

.htaccess - 无法在 htaccess 或 robots.txt 中阻止 AspiegelBot

ruby - compass -v 在 CentOS 上使用安装了 rvm 的 ruby​​ 1.9.3 失败

ruby-on-rails - rails : wkhtmltopdf RuntimeError (Location of wkhtmltopdf unknown)

linux - 常驻内存使用的概述/历史

python - 带有适用于 Ubuntu 的 Python 客户端和 Gui 工具的免费 RDMBS