chmod

How to convert an input of 3 octal numbers into CHMOD permissions into Binary?

孤者浪人 提交于 2019-12-23 02:41:05
问题 I am trying to create a program that takes input from the user using the command line of 3 octal number, for example 5, 2, 6 or 5,2,6 and convert them into 3 sets of 3 digit binary numbers, like 101 010 110, and also print out those corresponding CHMOD permissions like r-x -w- rw-. I am having a lot of trouble splicing these numbers apart with substring into 3 separate numbers of 5 2 and 6. I also need the program to convert from the set of binary digits into 3 numerical digits and

ssh免密码登陆

▼魔方 西西 提交于 2019-12-22 16:09:27
一、查看系统安全日志,定位问题 执行 sudo cat /var/log/secure 查看系统的安全日志,然后再安全日志中看到SSH登录过程中提示了如下错误: serverA 免密码登录到 serverB 机器A 向 机器B 进行免密码登陆 step1: 在机器A中 命令:ssh-keygen -t rsa,一路回车就行,如果需要passphrase密码,自行输入就行,一路回车passphrase密码为空 此时在 ~/.ssh/ 目录下生成了公钥(id_rsa.pub)和私钥(id_rsa) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- step2: 把机器A的公钥(id_rsa.pub)复制到机器B ~/.ssh/authorized_keys 文件里,两种常用方法 方法1: scp ~/.ssh/id_rsa.pub username@host:/home/B/id_rsa.pub /

Copy files to another package folder (root, su)

人盡茶涼 提交于 2019-12-22 09:29:40
问题 I have my application's package (com.my.package) and i'd like to be able to copy some files (a.txt, b.txt and c.txt) to another package (data/data/com.another.package/files). Now i've tried a few things i found, but none worked. Any help please? 回答1: You need to get the Runtime and use the cat command. Runtime.getRuntime().exec("su cat filepath1 > filepath2"); 回答2: Runtime.getRuntime().exec("su cat filepath1 > filepath2"); creates an empty file for me too. I have to use su -c instead Runtime

chmod 775 on a folder but not all files under that folder

送分小仙女□ 提交于 2019-12-22 03:59:05
问题 by assigning 775 rights of user to a folder (project) does that impact the files permissions under the folder? # chown -R root:user1 /var/www/project/ # chmod 775 -R /var/www/project/ Meaning, if /project/config.html used to have a 664 right does that mean that 664 right disappears and grants 775? How to avoid this to happen? There are files and folders with different rights under /project/ and I do not want these to be overridden. 回答1: Remove the -R flag. That means it changes all files and

How to chmod files within a python setup.py?

非 Y 不嫁゛ 提交于 2019-12-21 20:25:11
问题 I created a python package installation with a setup.py, and i want it to copy a data file in the folder (created for the occasion) ~/.did. The problem is that i have to call setup.py with sudo rights, as it writes in /usr/local/... So when my data file is copied in ~/.did, only the root user has write access to the file. I decided then to add a call to os.chmod() after the setup() function, but i'd like to know if anyone had a more clean way to do so. Here is my setup.py file : #!/usr/bin

Git changes the permissions on a single file unexplainably

寵の児 提交于 2019-12-21 17:01:35
问题 I am the only person involved with this git project. Every time I edit files at my local Ubuntu repository, then push to Bitbucket and pull to my production repository, git changes the edited files to -rwxrwxr-x 775. Apache doesn't like this. Local system: git version 1.8.1.2 on Ubuntu Linux Production system: git version 1.7.12 on CentOS/Red Hat Linux When I fix permissions to 755, then do git diff or git diff -p It shows nothing. At my local repository, the permissions are 755 and the files

深入理解认知Linux 命令

耗尽温柔 提交于 2019-12-21 11:21:02
1.查看当前目录下对应的文件信息 ls //list列出当前目录下的文件信息 ls -l 或 ll //list list以详细信息形式 列出当前目录下的文件信息 ls -a //list all 列出当前目录的全部文件(包括隐藏文件) ls -al //以详细信息形式 列出当前目录的"全部"文件(包括隐藏文件) ls 目录 //查看指定目录的文件信息 ls -li //显示当前目录详细的文件信息,并显示“索引编号” 查看当前操作位置 pwd //查看当前操作位置 目录切换 cd 目录 cd … //向上级目录切换 cd etc //切换到etc目录 cd //切换到当前操作用户的家目录 cd ~ //效果同上指令 用户切换 su - //切换为超级管理员root用户(账号和权限都是root) su - root //与上边指令效果一直 su root //账号是root,权限是普通权限 exit //退回到之前的账号 su 普通用户 //切到账号为具体普通用户 $ 普通用户操作 root用户操作 //多次使用su指令会使得用户出现叠加效果 //需要输入多次exit指令退回到之前的用户 shuhua—>root—>shuhua—>root 查看当前用户是谁 whoami //查看正在操作用户信息 who am i //查看登录系统用户信息 操作窗口切换 init 3 /

chmod a freshly mounted external drive to set up writing access

会有一股神秘感。 提交于 2019-12-21 11:01:35
问题 I have mounted a external drive at: # mkdir /mnt/external and subsequently: mkdir -p /mnt/external mount /dev/sdb1 /mnt/external Now only the root-user has access to write to these folders. linux-wyee:/home/martin # dir /mnt drwxr-xr-x 2 root root 4096 13. Dez 22:01 external How to change this - how to change that all can write to the external drive. I need to change the permissions within the terminal. chmod 777 /dev/sdb1 /mnt/external or something alike - 回答1: Try this first, umount /dev

PHP chmod( ):Operation not permitted, safe_mode deprecation involved?

梦想与她 提交于 2019-12-21 07:24:12
问题 I'm struggling a bit to grasp the concept of chmod() from PHP as the course I'm currently taking is a bit outdated and involves safe_mode. It states that as safe_mode is turned off, the restrictions to modify permissions with chmod() to a file when the owner is not the same as the one executing the command are removed. I'm working with PHP 5.5.9 in conjuncture with XAMPP, I've verified that the flags are turned off (just in case), but can't seem to get it working. As I execute the following

chmod WSL (Bash) doesn't work

不羁岁月 提交于 2019-12-21 06:56:27
问题 Running bash on windows 10, the simple syntax below works when I SSH to my webserver, but not when I exit out and am on my local machine. It doesn't give me an error, but I can see permissions are unchanged. I have to checked that I am set up as an administrator on my computer. Is this an error or is this just a consequence of the local operating system being windows? IF the later, it makes me question the value of using bash on windows if common operations such as this won't work. $chmod 644