Hot answers tagged

84

No, the sticky bit was not like the set-UID or set-GID flags. It didn't effect any changes to process credentials. What the sticky bit did was make the program text "sticky". It wasn't a misnomer, originally. background: program image sections and shared text In essence, without getting too deep into the details of executable file formats (which can, ...


12

-g sets the initial, or primary, group. This is what appears in the group field in /etc/passwd. On many distributions the primary group name is the same as the user name. -G sets the supplementary, or additional, groups. These are the groups in /etc/group that list your user account. This might include groups such as sudo, staff, etc.


9

chmod -x+X -R * The -x removes execute permissions for all The +X will add execute permissions for all, but only for directories.


7

They are not the same. The -g option specifies the "primary" group that a user should belong to, while the -G option specifies one or many supplementary ("secondary") groups. On a work machine I have access to I have $ id uid=1001(me) gid=1001(me) groups=1001(me),27(sudo),110(lxd),1005(theproject) This shows that my "primary" group is me (same as my ...


7

Some systems support changing the permission of a symbolic link, others do not. chmod -- change file modes or Access Control Lists (OSX and FreeBSD, using -h) -h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to. chmod - change file mode bits (Linux) chmod never changes ...


7

One way to do it: find backup -type f -exec chmod 0644 {} +


6

1 - use a programming language that implements chmod Ruby: ruby -e 'require "fileutils"; FileUtils.chmod 0755, “chmod"' Python: python -c "import os;os.chmod('/bin/chmod', 0755)” Perl: perl -e 'chmod 0755, “chmod”' Node.js: require("fs").chmod("/bin/chmod", 0755); C: $ cat - > restore_chmod.c #include <sys/types.h> #include <sys/...


6

setfacl is designed to accept getfacl output as input. Meaning you can run getfacl, save the output to a file, do your thing, then restore the ACL. The exact procedure can vary depending on your platform. On Linux though: # Take a peek at the current ACL [root@vlp-fuger ~]# getfacl newFile # file: newFile # owner: root # group: root user::rw- group::r-- ...


6

Adding yourself to the lp group is probably the best solution here. That would not cause the lp0 file not to appear. (It's theoretically possible that your system has been configured to cause lp0 not to appear if you're in the lp group, but 1. that would have to be a local configuration, not a default setup from a distribution; and 2. I don't see why someone ...


6

You would strip all security from your system making it extremely vulnerable. Lots of programs would stop functioning due to insecure permissions. You are technically right it would append those rather than over write so you would keep SGID and SUID permissions. I have an old Ubuntu machine I no longer need so I figured I would test this. After running chmod ...


5

No, vim is not set user id (that is, it will not change effective userid). running a command line from vim will give you a shell (that is the word) as user2. By the way, to edit the file you must either be user user3 belong to group user2, merely being user2 is not enough. There used to be a bug in redhat 4.x (or still is) when running visudo, which ...


5

With "wq", "!" asks Vim to ignore the read-only attribute. From the documentation: :wq [++opt] Write the current file and quit. Writing fails when the file is read-only or the buffer does not have a name. Quitting fails when the last file in the argument list has not been edited. :wq! [++opt] ...


4

This will go through your files and set the executable bit according to whether file believes that the file should be executable: find /var/www/html -type f -exec bash -c 'if file -b "$1" | grep -q executable; then chmod +x "$1"; else chmod -x "$1"; fi' None {} \; The find command is very similar to yours. The change is the addition of the bash commands. ...


4

Ok, I re-read the "chmod" man pages for Mac OS X, BSD, and Linux, and did a few experiments. Here is what I learned about symbolic modes. It can get complicated, but it's worth understanding: The general form is clause[,clause…] where: clause := [ugoa][+-=][rwxXstugo] [ugoa] (specify multiple) means set the permission for user, group, other, or all. If not ...


4

I don't think there is any faster way. You could come up with a script that copies the ownership info from a working installation, but writing the script would probably take more time than creating a new instance and starting from scratch.


3

The mount options do not change the mode of the file. But can remove a permission. E.g noexec stops execution of file-files (not directories), nosuid nullifies the effect of setuid bits, nodev stops dev files from working, readonly stops writing. Mount options apply to the whole mount. And never add permissions. “keeping only what is allowed in both” — ...


3

In my answer I will not concern myself with Vim, but instead look at the underlying mechanisms, that you have stumbled upon. It is important to understand these, as it affects the security of your entire system. It has nothing to do with owner: try it, make a file not owned by you, then give your self read not write. You will get the same results. So why is ...


3

Yes Yes Yes It depends, complex program (database, tomcat like web server) do, smaller (gif generator) don't. It depends, if no set user id, program will run as clicking user. root mostly, some as www (if you have a web server), some as bin, mail.


3

That's not what the default entry means on a ACL; if you look at the new file you created you'll see it already has an ACL (the + at the end of the ls output), and a getfacl test_file will show it has group:www-data:rwx associated with it. If you want the newly created file to be owned by www-data then you need to add the setgid bit on the directory. ...


3

As @Tejas mentioned, you need to understand umask and its values for changing the default permissions. I recommend you read this article so you'll understand how to use it properly. In addition, you should know that it's not permanent, so after rebooting your system the umask value you've set will be gone. To set it in a permanent way, you need to write a ...


3

stat(1) can show many file associated attributes by specifying special format strings to it's -c option. In your case, use stat -c '%a' ~/.ssh/authorized_keys to receive the same file mode in octal, 600. See it's manual page for a full list of supported format modifiers.


3

The problem you are having is not a sudo problem, but a root permission problem. The filesystem that has hduser's home directory is not local to the machine and doesn't grant root permission to it. So when you did su - hduser you automatically changed to that directory, so sudo ls tried to run the ls command as root and that is where the error came from. ...


2

You can't use the plugin portions of this package at this time, as a non-admin user. You and I both know that is a security risk, and others may know it is not necessary, but that is the answer. I verified that what you mentioned before about sudo was correct, and as well, there were no unix-level tweaks I could work out. I agree it would be cool if in ...


2

Boot into recovery on your droplet and you should be able to at least login after fixing some permissions. You might need some trial and error on which directories will be necessary. I'd start with /bin, /sbin, /usr/bin etc.


2

I do not recommend this solution, for this problem. You can edit /etc/sudoers to configure sudo to allow execution of a script without a password.


2

By saying you're in user2's shell you imply you've been logged in as user2, the command whoami or echo $LOGNAME will let you know the same. Whatever commands you are firing in the terminal are considered to be fired by the logged-in user, except for those through sudo. The coloumn names in an output of ls is as below, for you reference. The Fourth field is ...


2

For instance does rw in fstab mean that the files will have read and write permissions when mounted? It means that the filesystem will be mounted read/write, with access subject to file permissions after that. If you mount readonly then absolutely nothing can write to the files, regardless of permissions. What will happen if they have only read ...


2

I thin these commands are not the same because you are using + in symbolic representation rather than = , so your observation may be correct but It is better to see the man page for chmod. man chmod ................... SETUID AND SETGID BITS chmod clears the set-group-ID bit of a regular file if the file's group ID does not match the user's ...


2

It seems like there isn't really much that needs fixing, at least on a fresh install of Ubuntu 15.10. Of course, if you've installed stuff, you will have files and directories that I don't. However, I believe this output will show the proper permissions to keep Ubuntu running. Some programs may be broken because of the command you ran, but Ubuntu will at ...


2

The best and easiest thing you can do is to add groups to each of your users, i.e. modifying your users! This task can be done by using usermod command. Read more here. Be aware that -g option is for user's new initial group (i.e. Primary) while -G option is a list of supplementary groups which the user can be also a member of. You can get more information ...



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