Tag Info

Hot answers tagged

43

I'll answer your questions in three parts: file types, permissions, and use cases for the various forms of chmod. File types The first character in ls -l output represents the file type; d means it's a directory. It can't be set or unset, it depends on how the file was created. You can find the complete list of file types in the ls documentation; those ...


15

So, permissions in Linux are very important. I will try to make a short explanation. For pieces of a file mode Every Unix file has a set of permissions that determine whether you can read, write, or run the file. Running ls -l displays the permissions. Here’s an example of such a display: -rw-r--r-- 1 user somegroup 7041 Mar 26 19:34 somefile I attach a ...


7

d means it is a directory, if you have a file it is - and if it is a link you will find an l. It can't be set/unset. If you use 0777 as permissions you are giving full control (read+write+execute) to every user/group of the system. It is a lazy way to solve problems when you have users/groups that can't access directories/files. For example, if you list ...


4

Was changing ownership of everything to root the right thing to do? No. It is, however, the quickest way I can think of to get the system to normal state. There are plenty of process which require some directories/files be owned by their user. Examples include logs, caches, working/home directories of some processes like MySQL, LightDM, etc. ...


4

To just get the mode: stat -c %a file (where file can also be a directory). Note: this is with the stat command from the GNU Coreutils. Otherwise the solution is system dependent.


4

When a directory has "x' (or searchable) permission, it is possible that specific files under a directory having for example 111 (--x--x--x) permission can be accessed if their name is known AND the permission of the destination file allows it. Directories with 'r' permission allow programs such as ls to basically open the directory as a file and read it ...


4

From man chown -R, --recursive change files and directories recursively


3

The nobody user is a pseudo user in many Unixes and Linux distributions. According to the Linux Standard Base, the nobody user and its group are an optional mnemonic user and group. That user is meant to represent the user with the least permissions on the system. In the best case that user and its group are not assigned to any file or directory (as owner). ...


3

To apply those permissions to a directory: chmod 755 directory_name To apply to all directories inside the current directory: chmod 755 */ If you want to modify all directories and subdirectories, you'll need to combine find with chmod: find . -type d -exec chmod 755 {} +


3

To get all the info provided by ls -l for a single file or folder, use the -d option and specify the file: ls -ld filename


3

You should also ensure that you have the right to access (go through) the /home/nazeem/public_html and /home/nazeem folders. You can achieve this by doing a chgrp to group deploy on both folders, and setting the execution rights for the group on these folders (execution permission on a directory gives the right to go through it). chgrp deploy ...


2

The issue likely isn't permissions-related (at least not on the Linux side). Once the recipient downloads the attachment, the file is owned by them. So is anything they take out of that zip file. I suspect the issue is one of the following: The recipient is trying to edit the file without downloading/unzipping it. Some file editors are smart enough to ...


2

You must remove the read permission on the directory for the other users e.g. by chmod 700 dirname You cannot allow access to a directory and hide just some of the files it contains.


2

If your intention is to do something depending on the file permission then in some cases you can consider simple test (aka [ or [[) conditional statement: -r file exists and read permission is granted -w file exists and write permission is granted -x exists and execute permission is granted For example: [ -w file ] && echo foo >> file


2

r allows listing — just the names. w deleting and adding. t prevents deleting — if you don't own it. x allows navigation — stating a file or directory: reading meta data, reading meta-data is needed to be able to access, add or delete a file within the directory. If you can not navigate, then you can not delete, add, or anything else.


2

If you automate things with scripts and make scripts on a regular basis, you should automate the script creation...with a script. So instead of calling: vi some_new_program.py you should have a script newpy: #!/bin/bash echo '#!/usr/bin/env python' > "$1" echo '# coding: utf-8' >> "$1" echo '' >> "$1" chmod +x "$1" vi +3 "$1" Of course ...


2

Subject to certain assumptions that the target user can actually access the file in its original location, the following approach could work: SRC='/path/to/existing/file' DST='/path/to/new/file' su target_user sh -c "ln -f '$SRC' '$DST'" && rm -f "$SRC" This "moves" the file to the new user's location, but does not change the ownership or ...


2

Setting the hostname in linux is done via the sethostname(2) syscall. And /bin/hostname is a bare wrapper around this syscall (and a few related syscalls). /etc/hostname is supposed to be read during the boot process by some script, who subsequently runs /bin/hostname to complish its job. CAP_SYS_ADMIN is one of linux capabilities(7), allows a thread to ...


1

The user who can login as nobody can change these files, but normally the system is setup so this is not possible. On my debian based system the entry in the /etc/password file is: nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin and /usr/sbin/nologin gives: This account is currently not available. You can only change this as user root, as ...


1

The pattern /home/ec2-user/bitcoin/*/ expands to the list of subdirectories of the directory /home/ec2-user/bitcoin, because of the trailing slash. (Except that directories whose name starts with a . are omitted.) If /home/ec2-user/bitcoin doesn't contain any subdirectory, then the pattern doesn't match anything, so it's left unmodified. Aside: don't run ...


1

You are basically asking two separate questions. How to set permissions on your local system to mirror the production one? You need to know the server configuration - in this case it includes configuration of the http daemon (httpd aka Apache in this case) - usually found in /etc/httpd or /etc/apache). You also need to know with what credentials daemon ...


1

This file has no extended attributes (actually ACLs), or more precisely, what you see in the owner@, group@ and everyone@ lines are the default ACLs for a 0700 file. Should you really want to remove for all users outside the owner even the ability to know the attributes of the file itself, you might at your own risks use these (untested on that file) ...


1

The obvious answer is sometimes the correct one.  You need to write to the cache directory, so you need write permission to the cache directory.  The fact that you're able to do the ls -l demonstrates that you have all the necessary access to the releases directory. You can get the desired access by either adding your user to the nginx group or changing the ...


1

You could require that all your users set default permissions to others=read (files) and others=read+execute (directories), so that your "root" account could read them. You could change NFS server providers to somewhere that permits no_root_squash. You could create the set of "fake" userids on your client machine, and then iterate across them, running ...


1

Instead ls use find -type: File is of type: b block (buffered) special c character (unbuffered) special d directory p named pipe (FIFO) f regular file l symbolic link s socket D door (Solaris) and find -perm: -perm mode File's permission bits are exactly mode (octal or symbolic). Since an exact match is ...


1

You need root access or request your system admin to allow sudo privilege to your user account 'axel'. If you do have root access, log in as root and execute visudo command and enter the following at the end of the file to allow 'axel' user to be able to run vim with sudo. axel ALL = /usr/bin/vim The above will only let you sudo to vim. You can give all ...


1

the permission to move/rename a dir, comes from the permission of the ".." dir (containing dir), not from the dir itself. Simple testcase $ mkdir testdir/subdir -p $ chmod -w testdir $ mv testdir/subdir testdir/othersub mv: das Verschieben von »testdir/subdir“ nach »testdir/othersub“ ist nicht möglich: Keine Berechtigung ==> no permission


1

As "permissions" doesn't just cover octal unix permissions on modern Linux systems, I'd like to elaborate a little: Apart from stat -c %a file @vinc17 suggested, there's stat -c %C file for the SELinux context on RHEL Systems, and getfacl file for volumes using ACLs. namei -m /path/to/file might be helpful for finding out all octal permissions leading down ...


1

Some reading: For the d questions: This tells you the Unix file type: By default Unix have only 3 types of files. They are.. - - Regular files d - Directory files Special files(This category is having 5 sub types in it.): b - Block file c - Character device file p - Named pipe file or just a pipe file l - Symbolic link file s - Socket file Read more: here. ...


1

Edit: Because yaan is a directory ,you have to give the execute permission like that: sudo chmod 744 yaan Explanation: 7 => give the read, write, and execute to the Owner. 4 => give the read to the Group. 4 => give the read to the Others. From the chmod manual page execute/search only if the file is a directory or already has ...



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