Tag Info

Hot answers tagged

33

The permissions 004 (------r--) means that the file can only be read by processes that are not running as the same user or as the same group as the FTP server. This is rather unusual: usually the user has more rights than the group, and the group has more rights than others. Normally the user can change the permissions, so it's pointless to give more ...


21

I played with it and apparently, exec permissions do not imply read permissions. Binaries can be executable without being readable: $ echo 'int main(){ puts("hello world"); }' > hw.c $ make hw $ ./hw hello world $ chmod 111 hw $ ./hw hello world $ cat hw /bin/cat: hw: Permission denied I can't execute scripts though, unless they have both read and ...


15

it make sense for directories, for example if you keep (secret) executables in a specific directory and then allow users call those files without being able to see the directory content (but knowing that a specific file is there after you informed them!). 333 compared to 111 allows writing/deleting files to/from those directories without being able to see ...


8

The octal permissions mask of 004 corresponds to a symbolic permissions mask of u=,g=,o=r which means that the (u)ser who owns the file cannot read it or write to it or execute it, and neither can other users in the same (g)roup as the user who owns the file. Only (o)ther users who are neither the owner, nor in the same group as the owner, are able to read ...


7

On a Linux system, when changing the ownership of a symbolic link using chown, by default it changes the target of the symbolic link (ie, whatever the symbolic link is pointing to). If you'd like to change ownership of the link itself, you need to use the -h option to chown: -h, --no-dereference affect each symbolic link instead of any referenced ...


6

Yes, but the file is owned by the user. So the client itself has the 0 permission (user) on the file and cannot read it. You can test this yourself: echo TEST > myTestFile; chmod 004 myTestFile; cat myTestFile; chmod 700 myTestFile; cat myTestFile; The third step will raise an error.


5

Obviously not all combinations are that useful, but to take the one you mentioned specifically... You actually don't need read permission to execute a file -- only execute permission -- unless the file in question is a script (e.g. a shell-script (.sh), perl-script (.pl) and so on). Normal binaries can be executed with just the execute permission. On ...


5

Use attributes: chattr -R +i files (as root) will add the +i attribute recursively to your folders and files which will prevent ANY alternations. Note that root will also be locked and you would need to unset the i manually every time. Ownership and alike will be left unchanged.


4

You can use NFSv3 to map on user and group IDs. If you don't want to map on IDs use NFSv4 instead which maps on user- and groupnames. So if you have two different clients who have a user called user-host-a and user-host-b who both have UID 500 they both have access to the files when NFSv3 is used. When you have two different clients who have a user called ...


4

The permissions you got were the permissions you asked for. The 't' comes from the '1' in the '1775' permissions string you specified, and sets what is called the "sticky bit". This tells the system that files in that directory can only be renamed or removed by the file's owner, the directory's owner, or the root user. The get the permissions you wanted ...


4

I may have misunderstood. But you can recursively use chmod and chown eg. chown -R username:username /path/directory To recursively apply permission 700 you can use: chmod -r 700 /path/directory Of course the above is for Linux so not sure if mac osx is the same. EDIT: Yea sorry forgot to mention you need to be root to chown something, I just assumed ...


4

GNU stat is available in the SUNWgnu-coreutils package. If you're not able to install that, the pkgproto command is an alternative. From the manual page: pkgproto /bin=bin /usr/bin=usrbin /etc=etc f none bin/sed=/bin/sed 0775 bin bin f none bin/sh=/bin/sh 0755 bin daemon f none bin/sort=/bin/sort 0755 bin bin f none usrbin/sdb=/usr/bin/sdb 0775 ...


4

chmod u+r doesn't do what you apparently think it does; what it actually does is make the file readable by its owner. Which, I'm going to guess, it already was. chmod o+r (make file readable by "others", i.e., not owner/group) would probably work, but security argues against this. Pick one: ls -l /var/log/apache2/error.log ... on my (Debian) system, its ...


4

I can think of many solutions for this specific problem : (A) Configure sudo access such that your username does not require password for tail command (or for all commands, if you so require) Refer sudo and sudoers Documentation for this. (B) Configure sudo access with negative timeout. Default timeout is 5 minutes , after that you will have to reenter the ...


3

It's because you are too early, if you wait until the UIDs are changed then your process runs as basic4_pwned. This worked for me: ./shellcode4js "test" & PID=$! sleep 0.0005 kill -SIGSTOP $PID grep ^Uid /proc/$PID/status Another try is to add a delay with usleep() and send the SIGSTOP later during that sleep. Then the programm runs with basic4_pwned ...


3

Sudo and the /etc/sudoers file aren't just for granting users full root access. You can edit the sudoers file with an existing sudo user, with the command sudo visudo You can group the commands that you want to grant access to like below: Cmnd_Alias SHUTDOWN_CMDS = /sbin/poweroff, /sbin/halt, /sbin/reboot Cmnd_Alias UPDATE_COMMANDS = /usr/bin/apt-get ...


3

The /sys (sysfs) filesystem is somewhat special; many operations are not possible, for example creating or removing a file. Changing the permissions and ownership of a file or setting an ACL is permitted; that allows the system administrator to allow certain users or groups to access certain kernel entry points. There is no special case that restricts a ...


3

I would debootstrap a base system to another directory. debootstrap --variant=minbase --arch=amd64 jessie /tmp/bootstrap http://ftp.us.debian.org/debian/ Then copy all files from /tmp/bootstrap/bin to /bin keeping the permissions. cp -a /tmp/bootstrap/bin/* /bin/ Now many (and the basic ones) of your files in /bin should be ok and you should be able to ...


3

Also note that the error you gave above ln: creating symbolic link `/etc/init.d/jboss1': Permission denied is not due to the owner of the symlink being somebody else than the owner of the original file. It is (most probably) caused by user askar not having write access to the directory /etc/init.d.


2

The use of -perm +mode seems to be deprecated. Maybe the help from man find can help to resolve your doubt: -perm mode File's permission bits are exactly mode (octal or symbolic). Since an exact match is required, if you want to use this form for symbolic modes, you may have to specify a rather complex mode string. For example -perm g=w will ...


2

When you access the directory via a server/browser combination of any kind, your credentials are not shared, so the server does not know that the person accessing the files is you. Try chmod a+x directory_B and chmod a+r directory_B/*


2

try as root find wherever -type d -name ... -exec chown Me {} \; where -type d apply to dir only -name ... your regexp -exec chown Me {} \; use chown on find dir. you must be root to chown.


2

Low-level control of USB devices is done via /dev/bus/usb, and you need to set the right permissions on the device there. The way to do that is with a udev rule: Create a file (such as /etc/udev/rules.d/52_local-usbtiny.rules) with: SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", MODE="664", GROUP="plugdev" That sets the group to ...


2

This comment was right; the web server was started before I added www-data to the git group. The web server was restarted when I rebooted for other reasons and the problem went away.


2

If you want to skip the unreadable files: find /external/hd/folder ! -readable -print >unreadable_files rsync -a --exclude-from=unreadable_files /external/hd/folder/ /local/folder This assumes that you're using GNU find, and that your filenames don't have embedded newlines. If you want to copy all files, regardless of whether they are readable or not ...


2

I realized that I forgot to mention that I aborted cp -a after checking the destination in another terminal as I was copying 300+ gb of data. Thanks to Gilles' comment I started testing to see whether it only happens to directories or not. As the tests prove below, basically all files are written as root and the old attributes are applied to the ...


2

You can add the line bellow in the /etc/sudoers file: main_user ALL=NOPASSWD: /usr/bin/loginctl kill-user *


2

Run sudo visudo and add this line: Defaults timestamp_timeout=-1 -1 = never timeout the password Also see man 5 sudoers Though the above solution attracts security concerns. Please follow this link to set up sudo to run without password for specific commands.


2

When you can not access to the directory you have right permissions, the first thing you should check is your access rights with parent directories: ls -ld /home/disk and: ls -ld /home/disk/disk1 You need at least execute permission to access the child of those directories.


2

When acting on symlinks, you must tell most of the tools (chown, chmod, ls...) not to dereference the link: you must add the -h parameter, as stated in the manpage : -h, --no-dereference affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink) So try : sudo chown -h askar.admin ...



Only top voted, non community-wiki answers of a minimum length are eligible