如何访问Ubuntu的ubuntu root目录录

当前位置:
ubuntu,/var/www/目录没写写权限
ubuntu,/var/www/目录没写写权限
来源:网络整理&&&&&时间: 18:46:58&&&&&关键词:ubuntu
关于网友提出的“ubuntu,/var/www/目录没写写权限”问题疑问,本网通过在网上对“ubuntu,/var/www/目录没写写权限”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:ubuntu,/var/www/目录没写写权限
描述:系统为ubuntu12,/var/www/ 目录的权限为:drwxrwxr-x
3 root root
4096 Dec 24 01:35 www为什么在www目录下创建文件或文件夹,都提示没权限啊,每次必须sudo才行,怎么解决解决方案1:你这里权限就是少了w权限啊,你 chmod 777 这个目录,加入写权限即可。在 ubuntu 中,你的用户并不是 root,这个目录的归属是 root 用户的,所以你的权限是最后一项 r-x 没有 w 权限。解决方案2:你这个文件夹是root的,chmod,chgrp,chown 三个命令选一个了解一下,用一个就好了解决方案3:sudo chmod 777 -R /var/www/解决方案4:drwxrwxr-x,从左到右第一个字母表示文件系统对象的类别,这里d表示为目录(文件夹)。其它文件系统对象:-(常规文件)、d(目录)、l(符号链接)、c(字符特殊设备)、b(模块特殊设备)、p(FIFO)、s(套接字)drwxrwxr-x 除出去第一个字母d后的rwxrwxr-x表示的是三种用户关系对文件或文件夹的操作权限。从左到右每三个一组,依次表示所有者权限、组权限、其他用户权限。每组的顺序均为rwx,如果用户有相应的操作权限就用相应的字母表示,如果不具有相应的操作权限就用-表示。比如: rwxrwxr-x表示文件或文件夹的所有者具有rwx(可读,可写,可执行)的操作权限,组用户也具有rwx(可读,可写,可执行)的权限,其他用户具有r-x(可读,可执行,没有可读)的操作权限。所以可以通过 sudo chmod 777 -R /var/www/ 修改其他用户操作权限或者sudo chown -R ubuntu:adm /var/www/ 修改文件夹的所有者和组。为什么是777? 可以参考 了解 Linux 文件和文件夹的操作权限
以上介绍了“ubuntu,/var/www/目录没写写权限”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1137950.html
上一篇: 下一篇:如何进入Linux系统的root文件夹中_百度知道
如何进入Linux系统的root文件夹中
好像说你没有权限 需要查看root目录吧
我有更好的答案
可以使用cd命令切换当前的文件夹。cd是change directory的缩写。命令格式:cd
[dirName] 用法示例:切换当前目录到系统root文件夹$ sudo cd /root注:切换到root文件夹需要root用户的权限。
采纳率:90%
来自团队:
如果是ubuntu的话,Alt+F2,输入gksu,确定,然后输入nautilus,确定,输入密码后会打开一个文件浏览器,在这个浏览器可以任意进入所有的文件目录或者添加删除文件
本回答被提问者采纳
进入终端:sudo -s -H键入密码,进入root模式cd /root
root登陆,ubuntu可以。
其他1条回答
为您推荐:
其他类似问题
您可能关注的内容
linux系统的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。linux命令中 root@ubuntu:/# 与 root@ubuntu:~# 不同
按时间排序
root@ubuntu:/#
这个是根目录,对一般用户只读,root用户有所有权限root@ubuntu:~# 这个是home目录,每个非root用户都会有自己的home目录 ----------其实我想知道的是/与#这两个符号的区别是什么,是否根目录不重要,为什么有些地方用/而有些地方用#/与#不是一类东西啊,/ 是指根目录,#是指root用户,这两个同时出现就是你以root登录当前目录是根目录一个是位置一个是权限,怎么对比啊?你要区分的是/与~ 或者 &与#吧?
ubuntu 安装成功后,如果没有设置过root 密码,按你说的只要有此sudo权限的用户都可以重置root密码,所以,一般系统安装成功后要修改root密码,这样其他用户修改时不能过密码验证。另外,使用时的安全策略是,不给普通用户管理员权限。如果给了,说明该用户就可以有修改root密码权限。
root身份: su -只读模式打开: vi -R /etc/grub.conf
mac os是Unix的直系后代,Linux是Unix的养子。不玩游戏,做音乐制作和图像设计 在你不考虑价格时,mac更好,他更易用。ubuntu安装软件就麻烦了。
感谢您为社区的和谐贡献力量请选择举报类型
经过核实后将会做出处理感谢您为社区和谐做出贡献
确定要取消此次报名,退出该活动?
请输入私信内容:订阅你的位置: >
> 【部分解决】Ubuntu中提升当前普通用户的权限使其变成sudo超级用户
【问题】已安装一个Ubuntu虚拟机。在其中想要折腾开发方面的事情。需要去到opt下建立文件夹,结果竟然说没权限:crifan@ubuntu:~/develop$ pwd
/home/crifan/develop
crifan@ubuntu:~/develop$ cd /opt/
crifan@ubuntu:/opt$ ls
crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: Permission denied
crifan@ubuntu:/opt$ users
crifan crifan
crifan@ubuntu:/opt$  所以,现在希望:每次,使用当前的普通用户,登陆后,即可具有超级用户sudo的权限。不希望再每次输入sudo,直接用。即把当前用户,提升权限,变成超级用户。【折腾过程】1.网上搜了一堆,都是开启Ubuntu的root用户的,对我此处没啥意义。2.参考:中提到了:去看了看,感觉不适合我。其只是,将用户变成对于某些东西有sudo 的权限,但是用起来,还是需要输入sudo的,还是很麻烦。3.继续参考上面的解释,说是可以把当前用户加到wheel or admin group。不太懂wheel是啥。以及如何添加。关于为何管理员组,被叫做wheel,这里有解释:4.然后去想办法,把当前用户加到管理员组里面。搜:ubuntu Add user to the wheel group找到然后去修改/etc/sudoers但是:一是没有%wheel二是要加的:# usermod -G10 user1也看起来不对:#明显是注释掉了此行而已所以,放弃此人的教程。5.搜:ubuntu Add user to the root group参考:去看看这些相关的命令:crifan@ubuntu:/opt$ su -
su: Authentication failure
crifan@ubuntu:/opt$ sudo -s
root@ubuntu:/opt# usermode --help
No command 'usermode' found, did you mean:
Command 'usermod' from package 'passwd' (main)
usermode: command not found
root@ubuntu:/opt# usermod --help
Usage: usermod [options] LOGIN
-c, --comment COMMENT
new value of the GECOS field
-d, --home HOME_DIR
new home directory for the user account
-e, --expiredate EXPIRE_DATE
set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE
set password inactive after expiration
to INACTIVE
-g, --gid GROUP
force use GROUP as new primary group
-G, --groups GROUPS
new list of supplementary GROUPS
-a, --append
append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help
display this help message and exit
-l, --login NEW_LOGIN
new value of the login name
-L, --lock
lock the user account
-m, --move-home
move contents of the home directory to the
new location (use only with -d)
-o, --non-unique
allow using duplicate (non-unique) UID
-p, --password PASSWORD
use encrypted password for the new password
-R, --root CHROOT_DIR
directory to chroot into
-s, --shell SHELL
new login shell for the user account
-u, --uid UID
new UID for the user account
-U, --unlock
unlock the user account
-Z, --selinux-user SEUSER
new SELinux user mapping for the user account
root@ubuntu:/opt# 6.但是仍旧不知道当前,存在哪些group。参考:貌似默认的是root这个group。7.所以,可以去试试:root@ubuntu:/opt# usermod -a -G root crifan8.然后再退出当前root用户:root@ubuntu:/opt# exit
exit去使用crifan,看看能否创建文件夹,结果还是不行:crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: Permission denied9.然后logout注销:重新用crifan登陆,再试试,结果还是不行。10.算了,还是进入系统管理工具里面, 试试如何把当前的用户,添加到root组里面。结果发现,当前用户,已经是administrator了:而且貌似无法更改属于哪个组。11.看来还是需要想别的办法。参考:去试试:crifan@ubuntu:~/Desktop$ sudo -s
[sudo] password for crifan:
root@ubuntu:~/Desktop# usermod -a -G sudo crifan然后再去试试是否可行,结果不行,然后又去试了其他的:crifan@ubuntu:~/Desktop$ cd /opt/
crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: Permission denied
crifan@ubuntu:/opt$ sudo -s
root@ubuntu:/opt# more /etc/sudoers
# This file MUST be edited with the 'visudo' command as root.
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
# See the man page for details on how to write a sudoers file.
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=&/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin&
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on &#include& directives:
root@ubuntu:/opt# cat /etc/sudoers
# This file MUST be edited with the 'visudo' command as root.
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
# See the man page for details on how to write a sudoers file.
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=&/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on &#include& directives:
#includedir /etc/sudoers.d
root@ubuntu:/opt# usermod -a -G admin crifan
usermod: group 'admin' does not exist
root@ubuntu:/opt# exit
crifan@ubuntu:/opt$ 重新logout后,再登陆试试,结果还是不行。12.再去参考上面帖子,去试试:给/etc/sudoers添加上:%wheel ALL=(ALL) ALL然后把自己加上:usernod -a -G wheel crifan结果总之还是不行:crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: Permission denied
crifan@ubuntu:/opt$ sudo gedit /etc/sudoers
[sudo] password for crifan:
(gedit:6653): IBUS-WARNING **: The owner of /home/crifan/.config/ibus/bus is not root!
crifan@ubuntu:/opt$ sudo -s
root@ubuntu:/opt# usermod -a -G wheel crifan
usermod: group 'wheel' does not exist
root@ubuntu:/opt# usermod -G wheel crifan
usermod: group 'wheel' does not exist
root@ubuntu:/opt# usermod -a wheel crifan
Usage: usermod [options] LOGIN
-c, --comment COMMENT
new value of the GECOS field
-d, --home HOME_DIR
new home directory for the user account
-e, --expiredate EXPIRE_DATE
set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE
set password inactive after expiration
to INACTIVE
-g, --gid GROUP
force use GROUP as new primary group
-G, --groups GROUPS
new list of supplementary GROUPS
-a, --append
append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help
display this help message and exit
-l, --login NEW_LOGIN
new value of the login name
-L, --lock
lock the user account
-m, --move-home
move contents of the home directory to the
new location (use only with -d)
-o, --non-unique
allow using duplicate (non-unique) UID
-p, --password PASSWORD
use encrypted password for the new password
-R, --root CHROOT_DIR
directory to chroot into
-s, --shell SHELL
new login shell for the user account
-u, --uid UID
new UID for the user account
-U, --unlock
unlock the user account
-Z, --selinux-user SEUSER
new SELinux user mapping for the user account
root@ubuntu:/opt# usermod -G wheel crifan^C
root@ubuntu:/opt# sudo -s
root@ubuntu:/opt# gedit /etc/sudoers
(gedit:6802): IBUS-WARNING **: The owner of /home/crifan/.config/ibus/bus is not root!
root@ubuntu:/opt# 13.继续参考:去给/etc/sudoers加上:crifan ALL=(ALL) ALL然后logout,再回来试试。结果还是不行。14.重启ubuntu试试,结果还是不行。15.索性,还是参考:去用此不太好,但是可用的办法吧:sudo gedit /etc/passwd将其中的:crifan:x::crifan li,,,:/home/crifan:/bin/bash改为:crifan:x:0:0:crifan li,,,:/home/crifan:/bin/bash logout,再进来试试,但是结果右上角,都没有下拉菜单了。而且打开终端会显示:I have no name !!!所以,还是去改回来吧。结果都进不去了:I have no name!@ubuntu:~/Desktop$ sudo gedit /etc/passwd
sudo: unknown uid 1000: who are you?结果只有强制关闭此Ubuntu虚拟机的电源才得以关闭,否则都没法关闭Ubuntu。。。16.重启后,的确是可以用root权限创建文件夹了:root@ubuntu:~/Desktop# cd /opt/
root@ubuntu:/opt# mkdir crosscompile
root@ubuntu:/opt# 但是很明显,当前用户,不是我的crifan,而是root了。所以,还是先去改回来:crifan:x::crifan li,,,:/home/crifan:/bin/bash然后重启Ubuntu。17.参考:去把之前添加到/etc/sudoers中的内容,放到最后,变成:#
# This file MUST be edited with the 'visudo' command as root.
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
# See the man page for details on how to write a sudoers file.
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=&/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on &#include& directives:
#includedir /etc/sudoers.d
#%wheel ALL=(ALL) ALL
crifan ALL=NOPASSWD: ALLlogout看看效果。还是没权限。现在,目前,是已经实现了,使用sudo,可以不用输入密码了:crifan@ubuntu:~/Desktop$ cd /opt
crifan@ubuntu:/opt$ ls
crosscompile
crifan@ubuntu:/opt$ rmdir crosscompile/
rmdir: failed to remove ‘crosscompile/’: Permission denied
crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: File exists
crifan@ubuntu:/opt$ mkdir crosscompile2
mkdir: cannot create directory ‘crosscompile2’: Permission denied
crifan@ubuntu:/opt$ sudo rmdir crosscompile/
crifan@ubuntu:/opt$ 18.但是,其实更希望做到的是:以crifan用户登陆,每次操作,连sudo都不需要输入,即可用于super user的权限。发现这人:和我需求是一样的。参考其中的解释,打算去:把id都改为0,但是是先创建一个新的用户,比如crifan2013,然后把crifan2013的id都改为0,然后就自动,好像变成了root用户了,就不用输入sudo了。不过打算先去试试另外那个方法,把密码留空。弄了半天,结果就是,把/etc/shadow最后一行中的,自己用户的密码,去掉,即从:crifan:$1$NH4QMkeN$pzTmJ07F.tF3T3H75Kw5R.:99:7:::变成:crifan::99:7:::但是此此处去执行sudo却还是没权限:crifan@ubuntu:/opt$ sudo sed &s/\(^$whoami):[^:]*/\1/& /etc/shadow & /etc/shadowbash: /etc/shadow: Permission denied所以,还是手动去修改算了。然后logout试试。结果还是和之前一样的效果而已:crifan@ubuntu:/opt$ ls
crifan@ubuntu:/opt$ mkdir crosscompile
mkdir: cannot create directory ‘crosscompile’: Permission denied
crifan@ubuntu:/opt$ sudo mkdir crosscompile
crifan@ubuntu:/opt$ 比如还是要输入sudo才行的。虽然无需再输入密码。 所以,还是用之前的:&把id都改为0,但是是先创建一个新的用户,比如crifan2013,然后把crifan2013的id都改为0,然后就自动,好像变成了root用户了,就不用输入sudo了。&去新建一个用户:(1)参考:crifan@ubuntu:/opt$ sudo adduser crifan2013
Adding user `crifan2013' ...
Adding new group `crifan2013' (1001) ...
Adding new user `crifan2013' (1001) with group `crifan2013' ...
Creating home directory `/home/crifan2013' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for crifan2013
Enter the new value, or press ENTER for the default
Full Name []: crifan li 2013
Room Number []:
Work Phone []:
Home Phone []:
Is the information correct? [Y/n] y
crifan@ubuntu:/opt$ sudo adduser crifan2013 admin
adduser: The group `admin' does not exist.
crifan@ubuntu:/opt$ sudo adduser crifan2013 sudo
Adding user `crifan2013' to group `sudo' ...
Adding user crifan2013 to group sudo
Done.(2)把/etc/passwd中的:crifan2013:x::crifan li 2013,,,:/home/crifan2013:/bin/bash改为:crifan2013:x:0:0:crifan li 2013,,,:/home/crifan2013:/bin/bash(3)给/etc/sudoers中最后添加:crifan2013 ALL=NOPASSWD: ALL(4)重启Ubuntu,用crifan2013登陆。结果竟然没有crifan2013这个用户。。。后来才发现,比如去:sudo gedit /etc/passwd中把其uid和gid都恢复到原先的1001:sudo gedit /etc/passwd然后才能出现新的crifan2013这个用户。然后用此用户登陆后,再去到sudo gedit /etc/passwd中,把id都改为0:sudo gedit /etc/passwd重启ubuntu试试。结果就还是没有了crifan2013这个用户。即,还是没有实现所要的效果。19.参考:先去开启了root。crifan@ubuntu:/opt$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
crifan@ubuntu:/opt$ sudo cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x::nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
messagebus:x:102:105::/var/run/dbus:/bin/false
avahi-autoipd:x:103:106:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
usbmux:x:104:46:usbmux daemon,,,:/home/usbmux:/bin/false
dnsmasq:x:105:65534:dnsmasq,,,:/var/lib/misc:/bin/false
whoopsie:x:106:110::/nonexistent:/bin/false
kernoops:x:107:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false
rtkit:x:108:114:RealtimeKit,,,:/proc:/bin/false
speech-dispatcher:x:109:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
lightdm:x:110:116:Light Display Manager:/var/lib/lightdm:/bin/false
avahi:x:111:118:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
colord:x:112:120:colord colour management daemon,,,:/var/lib/colord:/bin/false
pulse:x:113:121:PulseAudio daemon,,,:/var/run/pulse:/bin/false
hplip:x:114:7:HPLIP system user,,,:/var/run/hplip:/bin/false
saned:x:115:123::/home/saned:/bin/false
crifan:x::crifan li,,,:/home/crifan:/bin/bash
crifan2013:x::crifan li 2013,,,:/home/crifan2013:/bin/bash
crifan@ubuntu:/opt$   【总结】至此,还是没有实现要的效果:可以将普通用户crifan变成sudo(超级用户),使得,每次做任何操作,都,本身已有sudo权限,且不用输入sudo。 目前只能实现的效果是:以crifan登陆,无需密码就可以登陆;在crifan使用sudo时,无需输入sudo的密码了;转载请注明: & 与本文相关的文章
16 queries in 0.266 seconds, using 10.87MB memoryLinux上设置用户通过SFTP访问目录的权限的方法
OSChina & 发布时间: 11:55:37 & 作者:乐晨 &
这篇文章主要介绍了Linux上设置用户通过SFTP访问目录的权限的方法,SFTP可以理解为使用SSH协议进行FTP传输的协议,因而同时要对OpenSSH进行相关设置,需要的朋友可以参考下
&sftp和ftp是两种协议是不同的,sftp是ssh内含的协议,只要sshd服务器启动了,它就可用,它本身不需要ftp服务器启动。
1.查看openssh软件版本,想sftp服务用户只能访问特定的文件目录,版本需要4.8以上代码如下:[root@localhost ftp]# rpm -qa | grep opensshopenssh-server-5.3p1-81.el6_3.x86_64openssh-5.3p1-81.el6_3.x86_64openssh-clients-5.3p1-81.el6_3.x86_642.新增用户,限制用户只能通过sftp访问代码如下:[root@localhost ftp]# useradd -m -d /opt/ftp/dave -s /sbin/nologin dave3.限制用户通过sftp登录进来时只能进入主目录,修改/etc/ssh/sshd_config文件代码如下:[root@localhost ftp]# vim /etc/ssh/sshd_config#Subsystem
/usr/libexec/openssh/sftp-serverSubsystem sftp internal-sftpMatch User dave
ChrootDirectory /opt/ftp/dave
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp重启ssh4.测试访问代码如下:root@10.1.1.200:test# sftp -oPort=22 dave@10.1.6.175Connecting to 10.1.6.175...dave@10.1.6.175's password: Read from remote host 10.1.6.175: Connection reset by peerCouldn't read packet: Connection reset by peer发现连接不上,查看日志代码如下:[root@localhost ftp]# tail /var/log/messagesJan
6 11:41:41 localhost sshd[4907]: fatal: bad ownership or modes for chroot directory "/opt/ftp/dave"Jan
6 11:41:41 localhost sshd[4905]: pam_unix(sshd:session): session closed for user dave解决方法:
目录权限设置上要遵循2点:
ChrootDirectory设置的目录权限及其所有的上级文件夹权限,属主和属组必须是root;
ChrootDirectory设置的目录权限及其所有的上级文件夹权限,只有属主能拥有写权限,权限最大设置只能是755。
如果不能遵循以上2点,即使是该目录仅属于某个用户,也可能会影响到所有的SFTP用户。代码如下:[root@localhost ftp]# lltotal 4drwxr-xr-x 3 dave dave 4096 Jan
5 13:06 dave[root@localhost ftp]# chown root:root dave[root@localhost ftp]# chmod 755 dave[root@localhost ftp]# lltotal 4drwxr-xr-x 3 root root 4096 Jan
5 13:06 dave然后在测试通过代码如下:root@10.1.1.200:test# sftp -oPort=22 dave@10.1.6.175Connecting to 10.1.6.175...dave@10.1.6.175's password: sftp& lstest sftp& cd ..sftp& lstest sftp& cd testsftp& ls1.txt
sftp& get 1.txtFetching /test/1.txt to 1.txt/test/1.txt可以看到已经限制用户在家目录,同时该用户也不能登录该机器。
大家感兴趣的内容
12345678910
最近更新的内容}

我要回帖

更多关于 linux 进入root目录 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信