file-permissions

How to check if “s” permission bit is set on Linux shell? or Perl?

吃可爱长大的小学妹 提交于 2019-12-02 18:19:21
问题 I am writing some scripts to check if the "s" permission bit is set for a particular file. For example - permissions for my file are as follows- drwxr-s--- How can I check in bash script or a perl script if that s bit is set or not? 回答1: If you're using perl, then have a look at perldoc: -u File has setuid bit set. -g File has setgid bit set. -k File has sticky bit set. So something like: if (-u $filename) { ... } 来源: https://stackoverflow.com/questions/29083434/how-to-check-if-s-permission

Single command to create a file and set its permission

半城伤御伤魂 提交于 2019-12-02 18:02:20
I am using the following 2 commands to create a 0B file and set its extn to 644 touch filename.ext chmod 777 filename.txt My question is that whether there is any single command in unix (korn shell) that will do the two things together that is to say create a 0B fil with desired permission? proski install -m 777 /dev/null filename.txt For bash , simply use chmod with file redirection and history expansion: chmod 777 filename.txt>>!#:2 For ksh and zsh you have to drop the history expansion (as shown above, there may be other ways) and use: chmod 644 filename>>filename For scripts of any shell

File system changes in Android Nougat

怎甘沉沦 提交于 2019-12-02 17:30:57
Ever since the first release of the Android N developer preview, I get "permission denied" errors when attempting to list the root directory or other system directories. The permissions on these directories didn't seem to change (as far as I can tell). Question: What change(s) in Android N caused these permission denied errors? How to replicate: In ADB shell, run the following commands: run-as com.debuggable.packagename ls / This gives permission denied errors on Android N. Why list system directories: I noticed this behavior on Android N with several file managers. They could no longer list

SCP Permission denied (publickey). on EC2 only when using -r flag on directories

a 夏天 提交于 2019-12-02 16:58:59
scp -r /Applications/XAMPP/htdocs/keypairfile.pem uploads ec2-user@publicdns:/var/www/html where uploads is a directory returns Permission denied (publickey). However scp -i /Applications/XAMPP/htdocs/keypairfile.pem footer.php ec2-user@publicdns:/var/www/html works (notice the flag change). uploads is an empty folder These are the file permissions for the uploads directory drwxrwxrwx 3 geoffreysangston admin 102 Nov 15 01:40 uploads These are the file permissions for /var/www/html drwxr-x--- 2 ec2-user ec2-user 4096 Jan 5 20:45 html I've tried changing html to 777 and that doesn't work either

Ansible - Mode 755 for directories and 644 for files recursively

北战南征 提交于 2019-12-02 16:55:40
I'd like to allow anyone to list and read all files in my directory tree, but I don't want to make the files executable : dir \subdir1 file1 \subdir2 file2 ... \subdirX fileX The following task makes my directories and files readable, but it makes all the files executable as well: - name: Make my directory tree readable file: path: dir mode: 0755 recurse: yes On the other hand, if I choose mode 0644, then all my files are not executable, but I'm not able to list my directories. Is it possible to set mode 755 for all directories and 644 for all files in a directory tree? Thank you. Adrien Clerc

Linux, Why can't I write even though I have group permissions?

☆樱花仙子☆ 提交于 2019-12-02 16:02:26
I want to create a file in a directory owned by the staff group which I am a member of. Why can I not do this? bmccann@bmccann-htpc:~$ ls -l /usr/local/lib/R/ total 4 drwxrwsr-x 2 root staff 4096 2010-07-31 16:21 site-library bmccann@bmccann-htpc:~$ id -nG bmccann bmccann adm dialout cdrom plugdev staff lpadmin admin sambashare bmccann@bmccann-htpc:~$ touch /usr/local/lib/R/site-library/tmp touch: cannot touch `/usr/local/lib/R/site-library/tmp': Permission denied AdamJonR Did you logout and log back in after making the group changes? See: Super User answer involving touch permissions failure

Android : change permission of system files

大憨熊 提交于 2019-12-02 15:20:36
问题 My phone is rooted and i wrote code in my app to change file permission of system file which is located at /sys/class/leds/lcd-backlight/brightness Runtime.getRuntime().exec("su"); Runtime.getRuntime().exec("chmod 777 /sys/class/leds/lcd-backlight/brightness"); but this code can't change the file permission of the specified file and i won't got any kind of error or exception 回答1: Download the RootTools.jar from this link https://github.com/Stericson/RootTools/releases Put that .jar file into

How do I change read/write mode for a file using Emacs?

て烟熏妆下的殇ゞ 提交于 2019-12-02 13:59:56
If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs? Bob Cross M-x toggle-read-only or in more recent versions of Emacs M-x read-only-mode On my Windows box, that amounts to Alt-x to bring up the meta prompt and typing "toggle-read-only" to call the correct elisp function. If you are using the default keyboard bindings, C-x C-q (which you read aloud as "Control-X Control-Q") will have the same effect. Remember, however, given that emacs is essentially infinitely re-configurable, your mileage may vary. Following up from the commentary: you

Android : change permission of system files

淺唱寂寞╮ 提交于 2019-12-02 12:28:08
My phone is rooted and i wrote code in my app to change file permission of system file which is located at /sys/class/leds/lcd-backlight/brightness Runtime.getRuntime().exec("su"); Runtime.getRuntime().exec("chmod 777 /sys/class/leds/lcd-backlight/brightness"); but this code can't change the file permission of the specified file and i won't got any kind of error or exception Download the RootTools.jar from this link https://github.com/Stericson/RootTools/releases Put that .jar file into your project's 'libs' directory import com.stericson.RootTools.*; . . Command cmd=new Command(0,"chmod 766

How to check if “s” permission bit is set on Linux shell? or Perl?

两盒软妹~` 提交于 2019-12-02 09:26:36
I am writing some scripts to check if the "s" permission bit is set for a particular file. For example - permissions for my file are as follows- drwxr-s--- How can I check in bash script or a perl script if that s bit is set or not? If you're using perl, then have a look at perldoc : -u File has setuid bit set. -g File has setgid bit set. -k File has sticky bit set. So something like: if (-u $filename) { ... } 来源: https://stackoverflow.com/questions/29083434/how-to-check-if-s-permission-bit-is-set-on-linux-shell-or-perl