New answers tagged

1

First time sudo is invoked password is prompted for. Then, depending on configuration, if invoked within N minutes (default 15 IIRC), one do not need to enter password again. You could do something like: sudo echo >/dev/null || exit 1 or perhaps something like: sudo -p "Become Super: " printf "" || exit 1 at start of script. If you want to prevent ...


1

You probably want to use rsync. To get that to work, you need to install it on both machines (if it's not installed already). After that, simply run (as root): rsync -avrHP root@source-host:/path/to/source-directory/ /path/to/destination this assumes that: You run the command on the destination host. If you want to run it on the source host, just remove ...


0

Run as root rsync -og maybe this is what you are looking for. From manpage: -o, --owner This option causes rsync to set the owner of the destination file to be the same as the source file, but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super options). Without this option, the owner of ...


2

Your user does not have the permission to write in the directory you are trying to copy the file. Use root account or try with sudo -u "user" cp file path.


1

In Unix, to do even the most basic stuff, a user needs access to sundry resources (executables, libraries, configuration files, manual pages, examples, ...). Even what is considered "normal commands" like cp(1), ls(1), are regular programs run by the user, who will need to be able to access them. Users need access to much of the system, that can't be cut off ...


2

It is much more difficult to prevent some particular access than to by default block all access and add specific exceptions for each kind of access. There is even a catchy term for this principle. Therefore, ensure that the commands that can be run via sudo are explicitly specified so that the user can never become root using it. After this has been done you ...


2

To create the hard-link alice will need write+execute permissions on target-dir on all cases. The permissions needed on target.txt will vary: If fs.protected_hardlinks = 1 then alice needs either ownership of target.txt or at least read+write permissions on it. If fs.protected_hardlinks = 0 then any set of permissions will do; Even 000 is okay. This ...


1

The problem is that your script is not set to be executable. chmod u+x /bin/ScriptThatCopiesBackup.sh will make the script runnable by its owner (in this case, root).


0

Your problem could be that you are editing the wrong crontab file. (Even though you said you are doing everything from root). Try editing the crontab file with crontab -u root. It is also possible that your script is not executable. chmod +x /path/to/yourscript.shshould make it executable.


0

You must need add uid (user identifier) and guid (group user identifier) like these: $ sudo mount -t nfs 10.9.XXX.XXX:/root/src /home/patryk/nfs_share -o rw,user,vers=3,uid=1001,guid=1001 Maybe you need to use id command to find your id/guid: $ id username Although you may use actual user/groupnames (beware of spaces) instead numeric uid, gid values.


1

I don't know anything about BackupNinja but if it (like most backup programs) can write to stdout then you can do something like this: echo foo | su -g users nobody bash -c 'umask 177; cat >/tmp/newfile' ls -l /tmp/newfile -rw------- 1 nobody users 4 4. Feb 09:39 /tmp/newfile


0

The owner of the files that are generated by a process are the same as the owner of the process itself. When your backup tool runs as root than the owner of the backup-tar will be root. The solution to the problem should be, that you run the backup process as user and not as root. I guess you use something like a cron job to do your backup. So Refer to the ...


0

Weirdly, on a RHEL6.5 install, the two-up directory permissions prevented login: % ssh dvpsmf blah@dvpsmf.test.com.au's password: Last login: Wed Feb 3 11:08:03 2016 from 10.14.107.212 Could not chdir to home directory /osp/local/home/blah: Permission denied $ $ ls -ld --context / /osp /osp/local /osp/local/home ls: cannot access /osp/local/home: ...


-1

chmod 400 {keyfile}.pem is what amazon instructed and it works.


3

That would be 476. A good way to remember is that read has the value of 4, write has the value of 2, and execute has the value of 1. Also, the first number is dedicated to owner, the second number to group, and the third one to other. owner group other Read 4 4 4 Write 2 2 2 Execute 1 1 1 You add the numbers together, ...


0

Either read in the "Explanation" field in the table below what you want to do, or do ls -l and see what it means. Each object (file, directory, sockets, device, etc) has 10 positions to indicate what's possible with the object. For example you could see -rwxr-x---. You can split the 10 positions up into these parts: The 1st character: what kind of object is ...


1

Your parsing is one letter wrong. In your parsing of syntax variable, you are getting for the string '--r,--r,--r': u='--r' g=',--' o='r,-' You should change your script to: u=${syntax:0:3} g=${syntax:4:3} o=${syntax:8:3} Also a tip, for debugging shell scripts try adding '-x' in your interpreter line. i.e '#!/bin/bash -x' Would give you a lot ...


1

There are a few errors. First, you’re creating your files with commas between each set of three: touch ./{r,-}{w,-}{x,-},{r,-}{w,-}{x,-},{r,-}{w,-}{x,-} But then you’re removing colons. The colon should be a comma. syntax="${i//:}" This might cause trouble if the script is in the same directory: for i in * Of course if you’re running it as ...


0

Try something like: cat dirName.txt | xargs -L 1 sudo -u ubuntu mkdir -p


2

Why not something like the following? user="foo" group="bar" perm=741 for dir in $(cat dirname.txt); do mkdir ${dir} chown ${user}:${group} ${dir} chmod -R ${perm} ${dir} done I find it best to utilize variables to make future changes easier. Iterating the directory list instead of a one liner is easier to maintain as well


-1

Add to /etc/usbmount/usbmount.conf: FS_MOUNTOPTIONS="-fstype=vfat,uid=$UID,gid=floppy,dmask=0007,fmask=0117"


0

What about aliases? Typing alias at the command line you will see all defined aliases. I'd suggest adding something like: alias rm='rm -i' Define it in ~/.bashrc, (so you can remove it in future or change it to suit your needs.) [mal@localhost ~]$ touch 123 [mal@localhost ~]$ rm 123 [mal@localhost ~]$ touch 123 [mal@localhost ~]$ rm -i 123 rm: remove ...


1

If you remove the 'w' bit, you can't accidentally overwrite whatever you removed the 'w' bit from. If that's a directory, that means you can't add or remove files from that directory; if that's a file, that means you can't change the file. Downside of that method, however, is that you lose data (IMO, file permissions are part of your backup data). An ...


2

It would generally avoid all the sudo and deliberately inhibiting yourself access to your files - it will likely cause you problems and possibly be so annoying you will just override your own protection mechanisms anyway. I would instead use trash-cli which behaves like a desktop type trashcan where you can recover your file later if you make a mistake. ...


0

Changing directories' permissions to 555 (or 550, or 500...) will prevent you from deleting or creating files inside them. Changing files' permissions to 444 will prevent you from modifying them. (You really need to combine both operations, since many editors will create a new file when "modifying" an existing one, which effectively means that you can end up ...


1

To give a process elevated permissions (in this case, being able to read the file while regular users can't) is exactly the functionality of SUID/SGID. Do read up on the whole UID/EUID mess, it isn't exactly trivial. You might get away by creating a group for this, make the file owned by that group, writeable only by e.g. root and readable by the group, ...


2

1) u can use the Network-manager or wicd but not the 2 at same time apt-get remove wicd 2)find the network device lspci -nn | grep -i network 3)verify the kernel module lspci -k | grep -i network -A 2 the ouput is somthing like 02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01) Subsystem: ...


1

If you are getting the permission and other details for gvfs as per the following d?????????? ? ? ? ? ? gvfs then just unmount your gvfs using the following command. Your issue will get resolve after following this process. umount ~/gvfs(umount /run/user/112/gvfs in my case). GVFS (GNOME Virtual File System) is the virtual file ...


-1

If you really want to protect the whole filesystem, then you can remount it readonly (normally requires root permissions). mount -o remount,ro /file-system/mountpoint


0

In linux, right click on the executable file and click on Permissions. Check the box Allow Executing the file. And try to execute the file.


0

There is no explicit one-one correspondence between Unix and Windows permissions, although they are analogous. Cygwin and MinGW exploit that analogy to imitate Unix permissions on top of Windows filesystems. WinSCP could have been written to use that type of analogy when copying to Windows, but it relies on the inherited folder permissions when creating ...


0

Its not such. I tried it several times and there is no loss in execution permission. But for your case you may try: chmod 777 try the above with root privilege is linux and then try to transfer it.


1

Files in Linux and Windows are handled very differently. Windows does not know the executable bit of Linux file permissions. That information (including the other permissions) are lost when transferring files from Linux to Windows or vice versa. Most probably the scp client at the Windows side sets the permissions of the copied files "the Windows way". That ...


0

find . ! -perm /007 ### In GNU find.


1

Network interfaces usually do not appear in /dev at all. Their configuration is not done with accesses to device files but with accesses to the NETLINK socket. I don't think that you can give access to this socket to an ordinary user. You need a suitable sudo rule (and maybe a wrapper script) so that the user can call ip addr.


-1

Use command newgrp to switch to apache's supplementary group updaters.


1

I believe you need is ssh-keygen, which remembers your "device signature". So even you changed your password, it still works as long as you ssh from the same device. Here is a detailed tutorial how to set it up. Does it need to be run in root privilege? No, you only need root privilege on the host-server when you set it up, in order to edit some file ...


1

It was asked before on ServerFault. Quoting with few modification and notes: Start the process with /usr/sbin/sshd -f ~/.ssh/sshd_config where ~/.ssh/sshd_config is a new file you created. Among other options (such as a different host key, different port, etc) you need to add the line UsePrivilegeSeparation no. This will prevent the sshd process from ...


1

In order to provide different rights to multiple groups or users use the following commands (Tested on RHEL 6 & 7): To make new owner of group: setfacl -m g:<group_name>:<rights you want to give eg.rwx> -R <directory_name> To check current acl settings: getfacl <directory_name>


2

Being unable to change permissions as root on a built-in application or system file on OS X is indicative of System Integrity Protection, a new security feature added in 10.11, which restricts the root account and limits the actions that the root user can perform on protected parts of OS X. Protected parts include /System and pre-installed ...


-2

You should be able to achieve your desired results as the root user on Mac OS X prior to 10.11 "El Capitan". "The user account named "root" is a special user in UNIX-style operating systems that has read and write privileges to all areas of the file system." If you have not already enabled the root user, here are the instructions on how to enable ...


6

-w- can be useful for fifos or files that can only be opened in append mode (chattr +a on Linux). prw--w--w- me me /var/run/sendstufftome Would allow others to send data, which a dedicated process running as me (but noone else) would read. It's also common for tty devices: $ ls -l "$TTY" crw--w---- 1 stephane tty 136, 25 Jan 18 14:06 /dev/pts/25 $ mesg ...


1

In regards to a file, I can't think of a well-known situation where a user would be permitted to write to a file, but not read it. Also, having the execute bit for a file set without the read bit set is pointless since the shell needs to read it in order to execute it. Now in regards to directories, a possible scenario could be some security through ...


0

It sounds like what you're trying to do is change the permissions which are assigned by default to a file when it is created. If so, I think you need to check out help umask. The umask setting is what determines what permissions are assigned to a file (or a directory) when it is created. (There are other factors involved as well; I'm not trying to give a ...


3

Initially, I guess, because it would have required a complex design that was out of line with the scope of early Unix systems. Later, I guess, because there was an established way of implementing user-level network port permissions for common cases: inetd, which appeared about a couple of years after after (4.3BSD) TCP/IP (4.2BSD). The inetd daemon runs as ...


0

This is due to your VSFTPD switching to passive mode. Follow these instructions. 1 . open file vim /etc/vsftpd/vsftpd.conf And write pasv_min_port=49152 pasv_max_port=65534 Save and close 2 . open file vim /etc/sysconfig/iptables-config And write IPTABLES_MODULES="ip_conntrack_ftp" Save and close. Restart vsftpd service ...


0

I think one reason is most users need to be able to use ephemeral ports for connecting to other servers, without necessarily being root. A TCP/IPv4 connection consists of two endpoints, and each endpoint consists of an IP address and a port number. Therefore, when a client user connects to a server computer, an established connection can be thought of ...


4

Linux supports network namespaces. You can make different processes see different sets of network interfaces. This is a broad topic. If you want a communication port that is accessible within the machine to specific users only, you can use a traditional Unix socket, which has a name in the filesystem space with permissions. Linux honors read/write ...



Top 50 recent answers are included