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 want to use rsync to upload a local web application on my OS X machine to a linux server.
I use this command :
sudo rsync -Harov --delete -e "ssh -p 33224" "/Users/me/myapp/" "linuxuser#12.34.56.78:/home/linuxuser/test-rsync-app"
The problem is that my local application has some folders that belongs to _www (on Mac OS X),
and when uploaded, they all belong to linuxuser, so I lose the ownership of the apache user for those folders.
Ideally, I would use rsync and the files that belongs to _www on my Mac would belong to www-data on the linux server.
Is there a way to do this ?
If you don't have root privileges on the Linux server then no, you cannot make the user (and group) be www-data.
If you do have root privileges, this question should be helpful to you:
rsync over SSH preserve ownership only for www-data owned files
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 9 years ago.
Improve this question
In my linux system i have two sudo users and another root. When i want to switch from sudo user to Root user, and put command SU to switch to root then system ask for Root user password.But when i enter same command with SUDO, like sudo su then my user switches to Root user and don't ask for Root user Password.
Tested on Ubuntu and Fedora, same behavior on both platform.
su will only ask for the root password if it's not already being run as root. sudo su runs su as root, by definition.
If you set up a user in sudoers without a command whitelist, you are giving that user free access to run anything as root. Don't be surprised for them to get a root shell without the root password. Also, restricting su via a command blacklist won't help either; there are many other ways to get a root shell. Whitelisting is your only defence.
(Blacklisting == user can do everything except X, Y, and Z. Whitelisting == user can only do X, Y, and Z.)
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 have Linux VPS and few accounts there. I used SSH with root logins to copy files from one account to another (e.g. in this folder
/home/firstacc/public_html/forum I typed cp -R * /home/secondacc/public_html/community).
Now when I use regular FTP to edit files on secondacc - I can't modify it - SmartFTP says permission denied. Now how do change ownership or permissions so they can be edited via regular FTP ?
use chmod to set the permissions (but be careful not to allow any wild process to modify your files) and chown/chgrp to change ownership/group-membership of your file.
ideally you would create a group (i call it 'fancyhomepage') where both users are members thereof:
# addgroup fancyhomepage
# adduser firstacc fancyhomepage
# adduser secondacc fancyhomepage
then make sure that all files you want to share belong to this group and are group-writeable
$ chgrp -R fancyhomepage /home/secondacc/public_html/community/
$ chmod -R g+rwX /home/secondacc/public_html/community/
$ chown -R <user>:<org> on the directory changes the permissions for everything in the directory and below.
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 need to ssh (as root) to a remote server and perform some root level operations. I will be sshing from a local server where I don't have root privileges. Given this option, is it possible to perform passwordless ssh to remote system using (rsa) keys ?
Local and remote servers run linux.
BTW, I generated keys (ssh-keygen -t rsa) on the local server. Copied the public key to remote server's .ssh/authorized_keys file. However it still keeps prompting for password. The same setup works fine, if the local and remote username (non-root) matches.
1 check that your /etc/ssh/sshd_config file have "PermitRootLogin yes".
2 Store the following Shell code into nopasswd.sh:
#!/bin/sh
scp ~/.ssh/id_dsa.pub $1#$2:~/
ssh $1#$2 "cat ~/id_dsa.pub >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys; exit"
3 Use it by these steps:
$ssh-keygen -t dsa
$ ./nopasswd.sh root REMOTE_HOST
Yes. SSH does not make a connection between account names on different systems, so you can ssh as non-root to root if you have a valid key pair.
In ~/.ssh/config:
Host rootRemoteSystem
HostName RemoteSystem
User root
Then:
ssh-copy-id rootRemoteSystem
Then you can do:
ssh rootRemoteSystem
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 am trying scp -r usernameipaddress:/path /pathwhereIwanttocopy, but I am getting it as connection refused.
How can I get it? How can I get connected?
The -r flag should work. In your example you seem to be forgetting the name of the folder you want to copy. Try:
scp -r nameOfFolderToCopy username#ipaddress:/path/to/copy/
to copy a folder from your local computer to a remote one. Or
scp -r username#ipaddress:/path/of/folder/to/copy /target/local/directory
to copy a folder from a remote machine to your local one.
You may also want to check out rsync. It has lots of options for handling duplicates, permissions etc.
rsync -r username#computer:/path/to/source /path/to/dest
or for upload
rsync -r /path/to/source username#computer:/path/to/dest
If you have a folder called working in your user directory, all you need is:
scp -r username#ipaddress:working ./
It's likely you'll get "Permission Denied" with this:
scp -r username#ipaddress:/working ./
Can you check to see if the ssh service is running on the remote machine? If you can login, try:
ps -aux | grep sshd
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 need to edit a file which is read only. This file is located at a remote appliance. Through ssh I logged in to this as admin and I have the root access.
Command "ls -l" show the permissions of file as
"-rwxr-xr-x 1 admin root 952 Oct 30 02:01 file.sh"
I am not as such familiar with Linux but I searched and found that this above line means that the admin is the owner and he/she has the read and write permission.
But the file is appearing to be read only, I am unable to edit it. So I tried to change the permission using command chomd
[admin#appliance targetfolder]# chmod 666 file.sh
chmod: changing permissions of `file.sh': Read-only file system
But still it is just read-only.
Someone suggested to remount the folder which contains this file.
How will I remount it, I used
" mount -o remount,rw /folde1/folder2/targetFolder"
but It gave
"mount: can't find /folde1/folder2/targetFolder in /etc/fstab or /etc/mtab".
Problem is solved, I remounted folder by using "mount -o remount,rw /" and then edited the file, without changing any permissions, it worked.