使用JSCH设置目录权限CHMOD [英] Set Directory Permissions CHMOD with JSCH

查看:256
本文介绍了使用JSCH设置目录权限CHMOD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix中,如何使用JSCH设置目录权限?我正在寻找做drwxrwxrwx. Filezilla说,该整数是775,但JSCH没有正确设置权限.在JSCH设置权限后,Filezilla表示它为407.

In Unix, how do I set the directory permissions with JSCH? I am looking to do drwxrwxrwx. Filezilla says the integer for that is 775 but JSCH is not setting the permissions correctly. After JSCH sets the permissions Filezilla says that it is 407.

推荐答案

Unix中的文件许可权代码(例如,777)是八进制的,而不是十进制的.如:当您执行类似chmod -R 777的操作时,数字将被解释为八进制输入而不是十进制输入.

The file permissions code in Unix (777, for example) are octal, not decimal. As in: when you do something like chmod -R 777, the digits are interpreted as octal input instead of decimal input.

此系统来自以下事实:有3个权限组:

This system comes from the fact that there are 3 permission groups:

  • 所有者
  • 世界

每个组都有一个开/关位",用于:

and each group has an "on/off bit" for:

  • 阅读
  • 执行

因此,基于八进制的基数足以表示组的所有可能的权限配置. 3个八进制数字分别对应于一个权限组.

so octal-base is sufficient to represent all possible permission configurations for a group. The 3 octal-digits each correspond to a permission group.

(有关此内容的进一步阅读: http://www.december.com/unix /ref/chmod.html )

(For further reading on this: http://www.december.com/unix/ref/chmod.html)

回到您的JSCH问题:十进制整数775的八进制表示形式是0o1407,我怀疑实际上是发送了十进制775而不是八进制775,FileZilla可能会截断这些内容0o1407的最低三位数字的左边(因为假设没有任何东西超出第三最低位是合理的)

Back to your problem with JSCH: the decimal integer 775's octal representation is 0o1407, my suspicion is that the decimal 775 is actually sent instead of the octal 775, and FileZilla may very well be truncating the stuff to the left of the 3rd least significant digit of 0o1407 (because it's not unreasonable for it to assume there's nothing past the 3rd least significant bit)

现在,509是八进制775的十进制表示,请尝试将其与JSCH一起使用.

Now, 509 is the decimal representation of octal 775, try using that with JSCH instead.

这篇关于使用JSCH设置目录权限CHMOD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆