Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a configuration file with me and want to make the file unreadable to others.
What can be done with it?
Encryption is a way to do it but Encryption makes the file uninstallable in Linux platform.
Just remove the readable mode bit for others
chmod o-r file.txt
or set the umask at creation time appropriately
umask 027
this turns off the w bit for the group and rwx bits for others, when you create a new file.
If it should be readable for the software only, you can set the permissions to
chmod 0400 file.conf
or with umask
umask 0377
Which is the same as -r--------.
For this to work, the file must have the same userid as the software process reading it.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
How can I create a file (not directory) with execution permissions using umask?
I know files use 666 permissions and directories 777 but I want to create files with 766, for example.
Use chmod to change the file permissions.
chmod 777 some-file
Or set the umask
umask 000
Strictly using umask, you cannot do this. Unless you are specifically creating an executable file with, say, gcc, the default permissions will be 666 minus umask. You must use chmod to add the executable bit to a standard file.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Consider a file with the following permissions:
rwx---r--
I am not the owner of this file, but I am a member of the group of this file.
My question is: do I have read access to this file?
I thought the answer was YES, since the world has read access to this file. But, a sysadmin is telling me that the answer is NO, since the group access bits are all off.
Can someone provide an authoritative answer?
drwxrwxr-x
Position 1 says whether it is a directory or a normal file. d for directory and - for normal file
Positions 2,3 and 4 stands for read, write, execute permissions for user of the file.
Positions 5,6 and 7 stands for read, write, execute permissions for group.
Positions 8,9 and 10 stand for read, write, exeucte permissions for the owner of the file.
So for rwx---r--, group has no permissions as group bits are turned off.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
What I would like to is create a directory that belongs to a group and each of those member can create, edit & remove files.
chgrp OldGroup NewGroup
chmod g=rwx
That's what I learned, but now my big problem is that I need to make sure people from that group can only delete their own files.
I am not sure how to put these rights,
if you have any ideas, please share them!
Thnx for reading.
did you try setting sticky bit?
chmod 1775 /directory/with/group/files
when the sticky bit is enabled on a directory, users (other than the owner) can only remove their own files inside a directory. This is used on directories like /tmp whose permissions are 1777=rwxrwxrwt
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am trying to copy files from one hard drive to another in my home server using the cp command. I am copying from an NTFS-formatted partition to an ext4 partition on a new hard drive I have installed.
Is it possible for the cp command to corrupt the transferred files?
Should I be using something like rsycn to verify file integrity is checked upon completion instead?
I would use rsync.
rsync can give you additional checksums, but the real power is the ability to resume after interruptions. This really helps for large files like VMs.
This really is more a serverfault question - See copying-a-large-directory-tree-locally-cp-or-rsync.
rsync should be better than cp when copying files.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
In addition to the files : /etc/group, /etc/passwd and /etc/shadow, I could see three files in my linux machine.
/etc/group-
/etc/passwd-
/etc/shadow-
I cannot see these files in my root filesystem. But when I try to add one user using useradd command, these files seem to get generated.
So i would like to know when exactly is these files created and what is the use of these files?
These are backups of previous versions.
Manual pages show these files and states:
/etc/passwd-
Backup file for /etc/passwd.
/etc/shadow-
Backup file for /etc/shadow.
Note that this file is used by the tools of the shadow toolsuite, but not by all user and password management tools.
See http://manpages.ubuntu.com/manpages/oneiric/man5/shadow.5.html and http://manpages.ubuntu.com/manpages/oneiric/man5/passwd.5.html