Re: [CentOS] scp -rp behavior(SOLVED)
On 03/01/15 10:44, Mark LaPierre wrote: On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? -- _ °v° /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird Wow! I didn't mean to start such a spirited discussion. ;-) Thank you all for your help and explanations. Very enlightening. Maybe I'll try out the rsync example when I copy all the user homes across. I would have to know all the user passwords in order to use scp to copy over home directories that are not mine. I already use rsync to do my nightly backups. -- _ °v° /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, March 1, 2015 8:02 pm, Mark LaPierre wrote: On 03/01/15 10:44, Mark LaPierre wrote: On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? -- _ ðvð /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird Wow! I didn't mean to start such a spirited discussion. ;-) Thank you all for your help and explanations. Very enlightening. Maybe I'll try out the rsync example when I copy all the user homes across. I would have to know all the user passwords in order to use scp to copy over home directories that are not mine. I already use rsync to do my nightly backups. If you do rsync as root (on both remote and local machines), then you do not need to know user's passwords. If you maintain machines under your administration so that the same user/group has the same user ID/ group ID on all machines, you can run rsync -avu /from remote:/path/where, and it will preserve UID/GID, timestamps and types, e.g. a symlink will stay a symlink,... Do not consider rsync a good backup (even if you use -b backup flag which preserves older copies by appending tilde). Real backup is you friend. Depending you the park of machines you maintain you may use something like backuppc (for small number of hosts) or bacula for large number of machines. There are many to choose from, others may suggest good ones they use. Good luck! Valeri Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? -- _ °v° /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird -- _ °v° /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/03/15 15:44, Mark LaPierre wrote: On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. snip scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird snip Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. snip Assuming the examples have been accurately copied, then the problem is an extra space. The first example is trying to copy mlapier@192.168.15.105: to /home/mlapier/.thunderbird (with the third parameter /home/mlapier/.thunderbird ignored). The successful example is trying to copy mlapier@192.168.15.105:/home/mlapier/.thunderbird to /home/mlapier which is what I assume you intended. -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJU8zeQAAoJEAF3yXsqtyBl5LMP/0vpm5iK/wpIzcUa8RoYpY7n 9R5IratPZ4NRP1V9XkC/VPEEf9gpwQ2RHASIyZvy6KFAGC0T/dHhtQXO27CE1mG5 K+MCGRAZvPXMbW/bHqDfqkH88DwmaRcmH/doRn2dUPGZpTRKrwyz/40qBBkkEYuF wi0+jeGpdwc/dC99rwVFTi8/G2OeVx6WSTHqpjMWn5Okl3E5bI7px+Z0EmARxP44 iqPDHoOfY7m17w3YwNePdO0vBcXlQKVMXb/0hP4G7Tvbt2+Z9i987ZzxcGf4pFbx MPO7wjIOuxsn4qUqBjXMWo6TnpsCBAv8XQeQk9Zxs3H9kVCZig8N7ITL5zWkgi2h 8FcQQWcmO3mZYbTsQY9JoqQo6JS/WGFrcfUrxwblz0qcXLcEe6t5+68cav3fXogh MGwaNXJeCU/Wc/ABQ/M4OONtZe8SEVcYecZzGrPQU6e86KuUMXo2oU6DgkcWQOiL 0Aap3gHw1Dq3Zm9K1I2IHPIqPVRLG2sIghLY1LjfsWYs4u35FXHb9vEzy33o86ml /SxvOR7QbWy7KPIlDdkJqcRMG6gYaV5/tfF6VaMg4HNmZkcmhVpAe9E4z3sXcYv5 q/WVfNWOw/UnrqEbFLq7N/uFNGvVpr4jSGxIYypyGTiJNq7fENrFs2ojEP8PAhMT f0blE1F6PVz+p4BGkRsV =rhcc -END PGP SIGNATURE- ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, March 1, 2015 10:22 am, Richard wrote: Original Message Date: Sunday, March 01, 2015 10:44:08 -0500 From: Mark LaPierre marklap...@gmail.com To: centos@centos.org, Mark LaPierre marklap...@aol.com Subject: Re: [CentOS] scp -rp behavior(SOLVED) On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird The problem is/was the space, after the colon, in your command: scp -pr mlapier@192.168.15.105: /home/mlapier quotes, slashes, etc. are totally unnecessary. If you are keeping the destination name the same as the source, you only need to use a . (dot) for the target (whether the destination directory/file already exists or not), not the full name. You only need a path on the target side if you are trying to put the directory/file in other than the home directory of the user you are logging in as. So, assuming you were in your home directory on the source side, all you needed is/was: scp -pr mlapier@192.168.15.105:.thunderbird . Well, you are right about dot for local argument, namely dot is expanded on local machine into path to current directory. For remote machine, however, you do have to specify absolute path to the directory you intend to rsync or scp. In your example remote directory quite likely does not exist, as your command is exact equivalent of this: scp -pr mlapier@192.168.15.105:/.thunderbird . whereas you may want to have: scp -pr mlapier@192.168.15.105:/home/remote_user_name/.thunderbird . Why slash: /.thunderbird in case of your example? Because if you do not specify absolute path beginning with / the ssh daemon prepends your relative path with its `pwd` it runs in, and its `pwd` is /) Another way to specify remote user's home directory would be: scp -pr mlapier@192.168.15.105:~/.thunderbird . and here quotes prevent ~ from being expanded on local machine, thus ~ is passed verbatim to remote machine and is expanded on remote machine into path to remote user's home directory. I hope I didn't mess up anything here ;-) Valeri Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, Mar 01, 2015 at 10:58:30AM -0600, Valeri Galtsev wrote: Why slash: /.thunderbird in case of your example? Because if you do not specify absolute path beginning with / the ssh daemon prepends your relative path with its `pwd` it runs in, and its `pwd` is /) I'm not sure I understand what you're saying here... Are you saying that if I run 'scp remotehost:.bashrc . it will copy /.bashrc from remotehost, regardless of whether my $HOME on remotehost is /home/username ? -- Jonathan Billings billi...@negate.org ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 big snip Why slash: /.thunderbird in case of your example? Because if you do not specify absolute path beginning with / the ssh daemon prepends your relative path with its `pwd` it runs in, and its `pwd` is /) Not so. Consider: $ ssh pi-1 pwd /home/jmr If you examine what is happening, the daemon creates an unprivileged process for the user, and that process performs the operation. Were it to be otherwise you would have a gaping hole in security. $ ssh pi-1 ps -f UIDPID PPID C STIME TTY TIME CMD jmr 3054 3050 0 04:22 ?00:00:00 sshd: jmr@notty jmr 3055 3054 0 04:22 ?00:00:00 ps -f $ ssh pi-1 ps -ef | grep ssh root 2432 1 0 Feb28 ?00:00:00 /usr/sbin/sshd root 3056 2432 0 04:23 ?00:00:00 sshd: jmr [priv] jmr 3060 3056 0 04:23 ?00:00:00 sshd: jmr@notty The first command shows the unprivileged process shelling out the ps command as expected. Note that the parent daemon is running as jmr@notty. The second command shows master daemon, the privileged child to handle the connection and the unprivileged jmr@notty. -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJU80j0AAoJEAF3yXsqtyBlr0EQAJNyKbeBSu0F22dqe+cIiTfl yydfgvCsqmg2xiAz4oQgiqHoYqjcj4XihnIclCmsrw+My4WAy5Yer59NVl/tVYPh n0YOAm2oobHTYL4rse/eeFUUga19JD1JAwCrs/k3GQwDXaoBf9PXcRAQBo4q44Mx peA7T9Fmb7eosz3xVS74hOeYFTPdOOMSr17ygGuyM9Q0vHgg3EyDUUPjotsp7eRe vr9eQI64DgPL1Q01BdZYqseHbLNxkCjL1tuDRy8Qzrj2i4S4JEPB8h8VJWVssoQw J6IqWz3hHi+9ecl5AX/jTdlgxUK7rhogMmQ7YanqA4MGCSZQkOmk7jz59ocD0S6q sswJVUOHbV1DVKCFR/G2SOfYecp9iIti5az58v4nPMzK/X8coB1ZeB9cZlKpGh94 2UU34UmynvgCSsw3THqS3QgTE4VtPAVtyLJWFjK+E+ilsJ6b84emEWoSZ/b7RhTg kADyr/xlmX6xXOUBQsME9ExfTVsKJv+wj02tFaxhEkup3bS2twAbRPprSy66TZXD 5OD8Nyz3lxSl1Z2qy7KzYhf3gY5gcYDXgtRPcNiM2sWOZTmoo+ZKJQVeVMyZ+inf 0Vls5joJrRi93XfVuWMijnT/A4aCAhbUBlPye7sX6uy96ButBsk/rAaolzNh1PdH Htsbqx50fPZbzNfyZ2BB =LGml -END PGP SIGNATURE- ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, March 1, 2015 11:14 am, J Martin Rushton wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 big snip Why slash: /.thunderbird in case of your example? Because if you do not specify absolute path beginning with / the ssh daemon prepends your relative path with its `pwd` it runs in, and its `pwd` is /) Not so. Consider: Indeed you are right. My bad. It starts worker process as user=remote user with pwd his home directory. Thanks for correcting the stupid idiot (which will be me) $ ssh pi-1 pwd /home/jmr If you examine what is happening, the daemon creates an unprivileged process for the user, and that process performs the operation. Were it to be otherwise you would have a gaping hole in security. $ ssh pi-1 ps -f UIDPID PPID C STIME TTY TIME CMD jmr 3054 3050 0 04:22 ?00:00:00 sshd: jmr@notty jmr 3055 3054 0 04:22 ?00:00:00 ps -f $ ssh pi-1 ps -ef | grep ssh root 2432 1 0 Feb28 ?00:00:00 /usr/sbin/sshd root 3056 2432 0 04:23 ?00:00:00 sshd: jmr [priv] jmr 3060 3056 0 04:23 ?00:00:00 sshd: jmr@notty The first command shows the unprivileged process shelling out the ps command as expected. Note that the parent daemon is running as jmr@notty. The second command shows master daemon, the privileged child to handle the connection and the unprivileged jmr@notty. -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJU80j0AAoJEAF3yXsqtyBlr0EQAJNyKbeBSu0F22dqe+cIiTfl yydfgvCsqmg2xiAz4oQgiqHoYqjcj4XihnIclCmsrw+My4WAy5Yer59NVl/tVYPh n0YOAm2oobHTYL4rse/eeFUUga19JD1JAwCrs/k3GQwDXaoBf9PXcRAQBo4q44Mx peA7T9Fmb7eosz3xVS74hOeYFTPdOOMSr17ygGuyM9Q0vHgg3EyDUUPjotsp7eRe vr9eQI64DgPL1Q01BdZYqseHbLNxkCjL1tuDRy8Qzrj2i4S4JEPB8h8VJWVssoQw J6IqWz3hHi+9ecl5AX/jTdlgxUK7rhogMmQ7YanqA4MGCSZQkOmk7jz59ocD0S6q sswJVUOHbV1DVKCFR/G2SOfYecp9iIti5az58v4nPMzK/X8coB1ZeB9cZlKpGh94 2UU34UmynvgCSsw3THqS3QgTE4VtPAVtyLJWFjK+E+ilsJ6b84emEWoSZ/b7RhTg kADyr/xlmX6xXOUBQsME9ExfTVsKJv+wj02tFaxhEkup3bS2twAbRPprSy66TZXD 5OD8Nyz3lxSl1Z2qy7KzYhf3gY5gcYDXgtRPcNiM2sWOZTmoo+ZKJQVeVMyZ+inf 0Vls5joJrRi93XfVuWMijnT/A4aCAhbUBlPye7sX6uy96ButBsk/rAaolzNh1PdH Htsbqx50fPZbzNfyZ2BB =LGml -END PGP SIGNATURE- ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, March 1, 2015 11:08 am, Jonathan Billings wrote: On Sun, Mar 01, 2015 at 10:58:30AM -0600, Valeri Galtsev wrote: Why slash: /.thunderbird in case of your example? Because if you do not specify absolute path beginning with / the ssh daemon prepends your relative path with its `pwd` it runs in, and its `pwd` is /) I'm not sure I understand what you're saying here... Are you saying that if I run 'scp remotehost:.bashrc . it will copy /.bashrc from remotehost, regardless of whether my $HOME on remotehost is /home/username ? Well, I was wrong, and somebody already corrected the stupid idiot (me). I forgot that the worker process is started as user=remote user with pwd= user's home directory. So what I said about absolute path _necessary_ it total nonsense. ;-( I guess I need more coffee in the morning on Sunday... Valeri Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
On Sun, March 1, 2015 9:44 am, Mark LaPierre wrote: On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird Theoretically, you don't need to escape with backslashes or put in quotes these things for paths on local machine. As everything that is not escaped is expanded on local machine, this doesn't screw things up (the best example: ~ is expanded into the value of path to user's home directory. if it is escaped in the remote argument, the symbol ~ is passed verbatim to the remote machine and is expanded on remote machine (which you probably intend when using ~ in remote argument). Otherwise: if it is not escaped, your shell on local machine expand ~ the way it should be on local machine and passes the result of expansion to remote machine, which may be different. but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird True, but only if you do not appends directory names with forward slashes. However, if you append the directory in both arguments with forward slash, what you say will not happen. E.g., say, /destination does exists, then: rsync -avu /source/ /destination/ will result in /destination updated with all new stuff in /source (unless something extra or newer is there in /destination, /desination becomes the same as /source). However, if you do not append directory name with forward slashes, the behavior will be different, and will be exactly as you have described: rsync -avu /source /destination if /destination directory exists will put /source inside /destination. So: appending directory name with slash changes rsync behavior as in examples above. Is there anything I missed (or messed ;-) - anybody? Valeri Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] scp -rp behavior(SOLVED)
Original Message Date: Sunday, March 01, 2015 10:44:08 -0500 From: Mark LaPierre marklap...@gmail.com To: centos@centos.org, Mark LaPierre marklap...@aol.com Subject: Re: [CentOS] scp -rp behavior(SOLVED) On 02/26/15 19:45, Valeri Galtsev wrote: On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote: Hey all, I'm trying to copy configuration files from my old CentOS 6.6 32 bit machine to my new CentOS 6.6 64 bit machine. On my 32 bit machine: [mlapier@mushroom ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:19:DB:E5:4E:9F inet addr:192.168.15.105 When I issue this command on my new 64 bit machine, 192.168.15.101: scp -pr mlapier@192.168.15.105: /home/mlapier/.thunderbird /home/mlapier/.thunderbird How about escaping dot (with backslash) for the remote machine, or just giving the whole path for remote machine in quotes: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier ? Also, if you want to specify destination directory (say with different name) you will need to end directory with forward slash both on local and remote, like: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird/ \ /home/mlapier/.thunderbird/ (this should be one line which didn't fit for me in one line hence backslash...) Valeri It copies all directories and files in 192.168.15.105: /home/mlapier/ to 192.168.15.101: /home/mlapier. I don't want all that, I just want the .thunderbird folder and all it's contents. The user and group account numbers match on the two machines for this user so that's not the issue. When I RTFM this is what I thought it said to do. I'm I misreading the FM or is something weird going on here? -- _ °v° /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Putting the source path in quotes, because of the dot, like this: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier worked. If the destination also contains a dot or other such character then put the destination in quotes too: scp -pr mlapier@192.168.15.105:/home/mlapier/.thunderbird /home/mlapier/.thunderbird but only include the destination directory if the destination directory does not yet exist otherwise you will get a copy of the source directory inside the destination directory like this: /home/mlapier/.thunderbird/.thunderbird The problem is/was the space, after the colon, in your command: scp -pr mlapier@192.168.15.105: /home/mlapier quotes, slashes, etc. are totally unnecessary. If you are keeping the destination name the same as the source, you only need to use a . (dot) for the target (whether the destination directory/file already exists or not), not the full name. You only need a path on the target side if you are trying to put the directory/file in other than the home directory of the user you are logging in as. So, assuming you were in your home directory on the source side, all you needed is/was: scp -pr mlapier@192.168.15.105:.thunderbird . period. - Richard ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos