Tag Info

Hot answers tagged

16

TL;DR find / ! -type l -print0 | sudo -u "$user" perl -Mfiletest=access -l -0ne 'print if -w' You need to ask the system if the user has write permission. The only reliable way is to switch the effective uid, effective gid and supplementation gids to that of the user and use the access(W_OK) system call (even that has some limitations on some ...


11

To add Eric's answer (don't have rep to comment), permissions are not stored in file but file's inode (filesystem's pointer to the file's physical location on disk) as metadata along with owner and timestamps. This means that copying file to non-POSIX filesystem like NTFS or FAT will drop the permission and owner data. File owner and group is just a pair of ...


5

The root directory is /. The themes directory in the root directory is /themes. A path that starts with / is called an absolute path; it starts from the root directory. A path that doesn't start with / is called a relative path; it starts from the current directory of the program where you use it. For example, a bare file name with no directory indication is ...


4

The problem was the permissions for / (the root directory) and the clue for finding that was this line from your strace output: access("/", R_OK|X_OK) = -1 EACCES (Permission denied) You were missing group read permission settings for /. But because you still had x (execute) permission, which allows you to traverse a directory, you could ...


4

That would depend on how you copy it. If you put it in a tar ball and copied that, then untarred it, tar will perserve permissions. If you use rsync it will also, depending on flags, perserve permissions. Those applications are responsible for the permissions. If you were to scp it permissions would not be preserved. The command doing the copying is ...


4

chgrp is to "change the group ownership of a file or directory". Thus, you can't change user ownership with that command (use chown instead, which can change user and group ownership) If your folder fruit is in 777 mode, obviously, anybody can create a sub-folder inside it. This sub-folder will be owned by the user who created it, so in your case, the ...


3

Incorrect POSIX permissions It means you don't have the execute permission bit set for script.sh. When running bash script.sh, you only need read permission for script.sh. See What is the difference between running “bash script.sh” and “./script.sh”? for more info. You can verify this by running ls -l script.sh. You may not even need to start a new Bash ...


3

The command chown needs root permission when transferring ownership to other users. chgrp is irrelevant since it only affects the group, not the user. You can't obligate someone to take a file from you if he doesn't want. If you are a root or with root permissions then you are the commander and you can do whatever you want. Instead as a workaround, you can ...


3

I would gate access to the filesystem through a directory that contains the mount point. As root: mkdir -p /media/group1only/workspace chgrp group1 /media/group1only chmod 750 /media/group1only This is full access to root and read+execute access for members of group1. Don't give them write access here, since if they accidentally rename the workspace ...


3

You can combine options with the find command, so it will find out the files with specified mode and owner. For instance: $ find / \( -group staff -o -group users \) -and -perm -g+w The above command will list all entries which belong to the group "staff" or "users" and have write permission for that group. You should also check for entries which are ...


2

You can use find with the -perm predicate. From man find (POSIX): -perm [-]mode The mode argument is used to represent file mode bits. It shall be identical in format to the symbolic_mode operand described in chmod() , and shall be interpreted as follows. To start, a template shall be assumed with all file mode bits cleared. ...


2

Perhaps like this: #! /bin/bash writable() { local uid="$1" local gids="$2" local ids local perms ids=($( stat -L -c '%u %g %a' -- "$3" )) perms="0${ids[2]}" if [[ ${ids[0]} -eq $uid ]]; then return $(( ( perms & 0200 ) == 0 )) elif [[ $gids =~ (^|[[:space:]])"${ids[1]}"($|[[:space:]]) ]]; then return ...


2

If the filesystem type is one that doesn't have permissions, such as FAT, you can add umask, gid and uid to the fstab options. For example: /dev/sdb1 /media/workspace auto defaults,uid=1000,gid=1000,umask=022 0 1 uid=1000 is the user id. gid=1000 is the group id. umask=022 this will set permissions so that the owner has read, write, execute. Group and ...


2

Why is this happening: Probably because the permissions (prior to you changing them with "chmod g+rwxs") didn't allow for the group to modify the file. eg. your group only had read permissions, and the (o)ther group didn't have write permissions either... What does "g+rwxs" mean: For the (g)roup add (+) (r)ead, (w)rite, e(x)ecute, (s)UID permissions (as ...


1

When you mount a FUSE filesystem, by default, only the user doing the mounting can access it. You can override this by adding the allow_other mount option, but this is a security risk if the filesystem wasn't designed for it (and most filesystems accessed via FUSE aren't): what are the file permissions going to allow other users to do? Furthermore only root ...


1

It turns out that this problem was specific to RaspberryPi, since the /dev/ttyAMA0 serial port that's linked to the hardware GPIO pins by default is initialized for virtual console access. I had to remove any reference to /dev/ttyAMA0 in /boot/cmdline.txt, reboot, and the /dev/ttyAMA0 now was with proper group permissions (read+write), however the group ...


1

The approach depends upon what you are really testing. Do you want to ensure write access is possible? Do you want to ensure lack of write access? This is because there are so many ways to arrive at 2) and Stéphane's answer covers these well (immutable is one to remember), and recall that there are physical means as well, such as unmounting the drive or ...


1

For example, assuming the filesystem on the disk supports ACL's, and using the hypothetical user, myusername, and the hypothetical group for accessing the disk, diskusers, something like the following could be done. $ indicated a command executed as a regular user; # indicates a command executed as the user, root. Create a group to which a user may belong ...


1

The umask set in your session does not affect cron. (In fact, each session could have a different umask.) You would need to set the umask at the beginning of your script executed by cron.


1

find /some/dir -type f -perm -020 -ls This works for both GNU and BSD find(1).


1

Don't give that user root access as pointed out by Mat. Instead, give them write permission to the relevant directory hierarchy. Use ps as dr01 mentioned to find the user. If the webserver runs in a multi-user environment with php wrappers, that won't necessarily be the same user under which Wordpress runs, though. In such cases you could run a script in ...


1

The Wordpress user is the user running the webserver (apache, apache2, httpd, etc). Do a ps -ef | grep apache or ps -ef | grep http .


1

Wildcards with sudo commands are a bit dicey. They can appear to give you security without actually doing so. To sudo, the * does not mean "any files under this directory" as it does in the shell. Rather, it means "any additional options" and must stand alone. Unfortunatley, you cannot in sudo restrict part of the arguments, and further, it wouldn't be ...


1

The permissions are stored in file system metadata. NTFS and ext3/4 file systems differ substantially in how they store metadata. One solution would be to create a tar file of the source directory (with or without compression), writing the resulting file to the NTFS file system. When the content of the tar archive is extracted to a ext3/4 file system the ...


1

Depending on what files you want, you can create a new group (/etc/group) and make the file writable (and the directory containing it if you want the user to create new files) by that group (e.g., chgrp <groupname> <file>; chmod g+w <file>


1

Either the filesystem is doesn't support setuid executables (because it's mounted with the nosuid option, or because it's a FUSE filesystem mounted by a non-root user), or there is a security framework such as SELinux or AppArmor that prevents setuid here (I don't think Ubuntu sets up anything like this though). That, or you didn't actually run these ...


1

You have to use commands su or sudo. Just adding user to group wheel or adding in sudoers is not enough. The su command switches to the root user – when you execute it with no additional options. You will have to enter the root account’s password. This isn’t all the su command does. You can use it to switch to any user account. If you execute the su john, ...


1

One thing to be aware, is that STIG locks down /tmp with noexec. If you already spent some time on the box, it's possible that you won't be able to execute the files out of that folder. Try another location for download/install. Also, run your installer as SUDO


1

Had the same problem, and your answer pointed me in the right direction. I found a different solution which does not require editing the apparmor configuration. Instead of using a symlink to redirect access to /home, use the bind option on mount. I added the following line to /etc/fstab: /elsewhere/home /home none bind Once you do this, apparmor won't ...


1

Did a bash command based on the response of Matteo :) Code: chmod $( stat -f '%p' $1 ) ${*:2} Usage: cp-permissions <from> <to>...



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