Tag Info

Hot answers tagged

48

You can also use the -d switch of ls: $ ls -ld / drwxr-xr-x 28 root root 126976 Mar 20 17:11 / From man ls: -l use a long listing format -d, --directory list directory entries instead of contents, and do not derefer‐ ence symbolic links


20

I would question why 53 users need sudo to do their day to day work -- for most users (even developers), sudo should be a rare exception, not such a routine thing that someone would casually run a sudo rm -rf * command. Can you use group permissions (or even more advanced ACL's) to give people access to the files they need to get their work done, perhaps ...


19

sudo does its authentication through PAM, like pretty much everything else on a Linux box. So you should be able to use pam_time.so to do this. By default on Debian at least, that module isn't enabled. You need to add a line that looks like this: account requisite pam_time.so to either /etc/pam.d/sudo to enable for only sudo or to ...


12

Use the -a switch of ls to include hidden files as well as . and .. in the listing and the -l switch for a "long" listing (which includes the permissions, among other information): ls -la / The first line (.) will contain the information about / itself: drwxr-xr-x 26 root root 4096 Mar 10 15:57 .


10

No, permissions are not inherited this way. The reason is slightly different: removing a file doesn't count as writing the file - it counts as writing the directory! This is why you can erase a file even when you have no rights over its content. Deleting an entire file is considered fundamentally different from editing it. The most thing you can do to a ...


9

I think you can use UDEV to do what you want. Creating a rules file such as/etc/udev/rules.d/99-thumbdrives.rules you'd simply add a rule that will allow either a Unix group or user access to arbitrary USB thumb drives. KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", OWNER="<user>", GROUP="<group>", MODE="0660" Would create the device ...


7

First off, chmod go-r doesn't remove write permissions, it removes read permissions. The contents of / is primarily directories; on directories read permission means you're allowed to list it. E.g., ls /bin will now give a permission denied (except for the directory owner and root, of course the owner is root in this case). If that was a typo and you meant ...


6

This will probably get closed for soliciting opinions or being too broad but I'll do my best. "UNIX ACL" is a really indirect way of referring to it. I'm supposing you mean POSIX-style ACL's. The chief drawbacks there are with the lack of expressiveness in the number of operations you can specify since it just extends the traditional read/write/execute ...


6

The simplest way would be to use to use suders.d (via inludedir) for your configuration. You could then have cron jobs that could place the rules for each user in to that directory for the times you desire. The #includedir directive can be used in /etc/sudoers to create a sudo.d directory that you can drop sudoers rules into as part of your rules.. For ...


6

If you want to grant global write permission on that directory, you have to do chmod a+w wp.localhost [1] This is because omitting the 'who is affected' letter (u, g, o or a) implies a, but won't set bits that are set in your current umask. So, for example, if your umask was 0022, the 'write' bit is set in the 'group' and 'other' positions, and chmod ...


5

First, a clarification: It requires to have root privilege to change permission to a file. From man 2 chmod we can see that the chmod() system call will return EPERM (a permissions error) if: The effective UID does not match the owner of the file, and the process is not privileged (Linux: it does not have the CAP_FOWNER capability). This ...


4

If you are removing an account, use userdel -r. This removes the user's home directory together with its contents. In addition the mail spool file belonging to the user is removed. I wouldn't assume that any directory couldn't have held objects belonging to the user in question. This is particularly true if the user had SUDO privileges. Use find to look ...


4

The ability to delete a file has nothing to do with the actual permissions on the file. It's the permissions of the directory that contain the file that govern this. Example $ whoami saml $ ll -d adir/ drwxrwxr-x. 2 samtest samtest 60 Mar 21 14:35 adir/ $ rm adir/afile rm: remove write-protected regular empty file ‘adir/afile’? y rm: cannot remove ...


3

How can I create a tar.xz archive, so that the files have root ownership when unpacked by root? That's up to the root who unpacks: tar --no-same-owner -xf ... If you want to make them all root to start with, you can use tar --owner=root --group=root -cf ...


3

If I understand you right then there is some file system on /dev/sdb that you have mounted. What matters here are the permissions in the file system that resides on /dev/sdb, the permissions of /dev/sdb are completely irrelevant for your question. Except that with permissions 0666 anyone can bypass the access control mechanisms for that file system and ...


2

Permissions are not inherited. Once you enter the directory, the files can have any permissions or ownership. For instance, you can have complete permissions over files two folders deep, but you may not have a permission to enter the directory. Writing permission on a directory means you can modify the list of files (move/delete/create file), but ...


2

chmod go-r * doesn't affect special groups at all. It just affects the rights for the primary groups and the "others". The primary group for everything in / should be root. So that doesn't change anything at all as root can do whatever he wants anyway. The other accounts usually do not read the contents of the directories in / as they know their paths. ...


2

The vfat filesystem does not support permissions. When you try to modify ownership or permissions on the mount point while the partition is mounted, it applies to the root directory of the mounted file system, not the directory that you are mounting on top of. If your goal is to make the filesystem read-only, try mounting with -o ro. You can do it without ...


2

Fakeroot The fakeroot utility, or the newer utility fakeroot-ng (same purpose, different implementation technique) runs a program and pretends to the program that it is running as root and that system calls such as chown succeeded. Only the program believes that these calls succeeded, nothing is actually reflected in the filesystem (it can't be since ...


2

You don't need sudo to fix that, try pkexec, pkexec nano /etc/hosts pkexec nano /etc/hostname After running pkexec nano /etc/hosts, add your new hostname in the line that starts with 127.0.1.1 like below, 127.0.0.1 localhost 127.0.1.1 your-hostname And also don't forget to add your hostname inside /etc/hostname file after running pkexec nano ...


2

As per man mount.cifs: uid=arg sets the uid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a username or a numeric uid. When not specified, the default is uid 0. The mount.cifs helper must be at version 1.10 or higher ...


2

This is normal unix behavior, however you can make cifs ignore remote user information. mount -t cifs -o \ user=blarg,password=blarg,nounix,uid=0,gid=0 \ //10.151.170.170/events /var/blarg/copy-to This makes all files look like they are owned by root:root. All files created will be owned by the user who mounted it; in this case, blarg. nounix ...


1

I had a detailed look into the udisks2 source code and found the solution there. The devices correctly mounted under user permissions were formatted with old filesystems, like fat. These accept uid= and gid= mount options to set the owner. Udisks automatically sets these options to user and group id of the user that issued the mount request. Modern ...


1

The methods you've mentioned are how I would've attempted to do it, in particular ACLs using setfacl to do it. I'd try and set the ACL at the top and make it so that it's recursively applied, but this would not protect files/dirs that are moved into this directory which are lacking it, I believe. You could use something like incron to run a script anytime ...


1

You need sudo or root privileges to edit the /etc/hosts file in your local host. If you don't, there is no way of editing this file. Then you must add an entry to /etc/hosts so that your local host can resolve properly the hostname of the remote host. This is the format of the lines in /etc/hosts 127.0.0.1 localhost.localdomain localhost 10.10.2.9 ...


1

You can choose the permissions of the files and directories on a vfat filesystem in the mount options. Pass fmask to indicate the permission on files that are not set, and dmask for directories — the values are the same as in umask. For example, to allow non-root users to only traverse directories but not list their content, and create files and directories ...


1

/dev/sdb is the block device name. Changing the permission of /dev/sdb will not affect the filesystem on /dev/sdb. Use mount to get the list of mounted mediums and mountpoints. Use chmod to change permissions in mountpoint. e.g. mount will show lines which looks something like /dev/sdb1 on /run/mount/pioneeraxon/disk1 type ext4 (...) In such case ...


1

When you see weird kernel behavior, dmesg is a great first thing to check. In your case, it gave an important pointer: 4 ofpart partitions found on MTD device spi32766.0 Creating 4 MTD partitions on "spi32766.0": 0x000000000000-0x000000500000 : "boot" 0x000000500000-0x000000520000 : "bootenv" 0x000000520000-0x0000006402c0 : "image" mtd: ...


1

The line /dev/sda7 on /media/Datos type fuseblk (rw) from mount's output tells you that /media/Datos is an NTFS partition (type fuseblk). NTFS cannot store ownership and permissions in the same way Linux/Unix filesystems like ext{2..4} can. That's why you can set ownership/permissions but they do not persist. You'll need to switch to a "proper" ...


1

First I think the problem is mounting the USB in the /run directory. Try this: create a mounting point on /media. Let's named myUsb sudo mkdir /media/myUsb Try to remount with rw permissions sudo mount -o remount,rw /partition/identifier /mount/point Then in your case the command will be sudo mount -o remount,rw /dev/sdc1 /media/myUsb



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