What do you mean with aan SSH agent. There is the SSH server and there is the SSH client. The server is normaly run on a system all the times (as a deamon) and the client is started when needed by somebody, most often by giving an ssh command from a shell. That “giving an ssh command in the shell” can of course be done at the end of the script that you start with cron. Only thing is how to provide userid, password and the fiel copy commands to that ssh session so that it acts as if it is called interactively from a terminal. Batch mode if you want to use a a name for it.
Now I have such a thing (sftp over ssh) running here and I can give you details if you want so.
You do that not with the agent (it may not be accessible in the cron
job, or the pass may have timed out). Instead you setup ssh with
interchanged pair of keys, and no password, at least for one user for
the purpose.
Then you use scp service, secure copy, which uses ssh behind.
Another possibility is email inside the network.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Carlos E. R. wrote:
> On 2013-04-18 08:56, autofocus wrote:
>
>> How should I proceed?
>
> You do that not with the agent (it may not be accessible in the cron
> job, or the pass may have timed out). Instead you setup ssh with
> interchanged pair of keys, and no password, at least for one user for
> the purpose.
>
> Then you use scp service, secure copy, which uses ssh behind.
>
> Another possibility is email inside the network.
Two more possibilities:
(3) use an rsync daemon
(4) make an NFS mount. Mount the backup directory within the backup
script, make the copy, and unmount the backup directory (or you can do
it with a pull-type arrangement instead of push-type)
@dhj-novell, thanks for the link. I am not sure if I fully understand that, but it seems to me not something that works easily from a cron run.
And yes, rsync comes to mind of course (I backup using rsync). And NFS might also be a solution. Both will allow to avoid the intermediate storage of the backup on the local system (although you may want both backups. localy and remote).
NFS will even let you do your backup in exactly the same way as you do it now localy, but it is in fact stored on a remote system (other building?)
hcvv wrote:
> @dhj-novell, thanks for the link. I am not sure if I fully understand
> that, but it seems to me not something that works easily from a cron
> run.
Yes, Carlos was quite right to say that it isn’t suitable for a cron job.
On 2013-04-18 12:06, hcvv wrote:
> What do you mean with aan SSH agent.
It is “something” that caches the paraphrases and/or passwords, so that
you don’t have to type them all the time in a session. Traditionally it
worked in console, but desktops such as kde/gnome have their own agents.
For example, in gnome/xfce, you fire up “seahorse” to set it up.
In “xfce4-settings-manager” I click on “session and startup”, then the
“application autostart” tab, and I can see that Gnome keyring GPG agent
is setup to start, and also the gnome keyring ssh agent. I also see
seahorse agent, which I’m not sure if it redundant with the previously
named one.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
hcvv wrote:
> So, when I understand you correctly, an “agent” is an “automated client”
> rotfl!
Not quite. You still have the client, but the agent assists you with
some of the tedious bureaucracy needed to use the client. Specifically,
it handles the authentication when you invoke ssh. It’s more like
power-assisted steering than a self-driving car.
I suggest that you look into host-based authentication. It might be a bit tricky to setup, but once you have it working you can use it without needing to run “ssh-agent”.
Thanks for all the replies. I decided to go with nfs mount after reading replies and expected that it will work and I’ll be able to post happy ending to the thread but unfortunately it failed.
let me explain what I did
install nfs-kernel-server on both machines
created a directory local-db-backup in ‘user-name-01’ home directory on machine with db running
created a directory remote-db-backup under user ‘local-user-01’ on machine where backup needs to be copied.
created /etc/exports on remote machine and added '/home/local-user-01/remote-db-backup db-running-machine-IP(rw,sync)
mounted above directory using yast on another machine.
created test file on local machine to see if it works and it was working fine. created test cron script where cron creates directory 01 and 02 in ‘local-db-backup’ directory and rotate backups to keep only last 2 copies.
in this step cron failed as it didn’t has permission to create directory.
i checked the permissions and realised that ‘local-db-backup’ directory now belongs to a different user. It belongs to first user created on machine. When I tried to change ownership by switching to root account, I got “Operation not permitted” error.
When you let work two (or more) systems closely together, you should be aware of the fact that users are identified by uersid (a number) and that you (as system manager of those systems) should make users that are needed on those systems use the same userid (else they are different. The username is only secondry (being better interpretable by human beinngs then just numbers). But it is of course best to have the same username on each system used for the same uerid.
Thus when you neclected that rule and you now have what you think is the same user with e.g. username autofocus having different userids like 1000 and 1001 on different systems, it is not the same user and thus ownership (which is of course per user id and groupid) is different. The best thing is to change this on one of the two systems (I hope you have no more then two in this aspect).
Be carefull doing this. First write down the different steps before you start and of course first make a backup. The precise steps may differ according to your set-up and/or needs. When data owned by a user you want to change to a different number, is only inside his home directory, that will make it easier to handle then when it is spread throughout he system.
the directory was mounted on live using yast. it shows different ownership . it is under user : tim
After adding map file and restarting server on backup machine when I try to do ‘ls’ on live machine it just hang. never display anything and never finishes. in the mean time if i remove map_static from /etc/exports on backup machine and restart server, the ‘ls’ command on live which is still waiting for something, display file/folder as usual.
On 2013-04-23 03:26, autofocus wrote:
>
> I found this about mapping and followed but when I add map file I can’t
> even use ‘ls’ on another machine. ‘NFS uid/gid mapping | KernelCrash’
> (http://www.kernelcrash.com/blog/nfs-uidgid-mapping/2007/09/10/)
That feature is news to me. It is not documented on “man exports”, so
perhaps it is not supported here. I would like a reference to a document
on it, preferable from openSUSE. Maybe it is new, 12.1 does not have it,
and some other version does.
Just one detail: use code tags to post here things like commands or
config files, otherwise they are difficult to read. Advanced editor, ‘#’
button. Posting in Code Tags - A Guide
Then, please do this:
cat /etc/export
cat /etc/nfs.live.map
and post it back here, complete with the commands, start to end.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Sorry, I didn’t realised about that feature not available in opensuse.
good news is that problem fixed. I switched the roles of machines and it worked smoothly. Probably I was doing something wrong. I didn’t have to edit or map any file.
I do not get it all, but when you are satisfied, that is OK.
Please next time (on your next question/problem, it is pretty sure you get one ) do not use QUOTE tags around computer text a s you did above, but CODE tags. It is the # button in the toolbar of the post editor.
On 2013-04-23 08:56, autofocus wrote:
>
> Sorry, I didn’t realised about that feature not available in opensuse.
I don’t know for sure if it is available or not. What I know is that it
is not documented in 12.1 manual page, it might be on a later version. I
don’t know what version you use in the server.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Carlos E. R. wrote:
> On 2013-04-23 03:26, autofocus wrote:
>> I found this about mapping and followed but when I add map file I can’t
>> even use ‘ls’ on another machine. ‘NFS uid/gid mapping | KernelCrash’
>> (http://www.kernelcrash.com/blog/nfs-uidgid-mapping/2007/09/10/)
>
> That feature is news to me.
Note that the article says “Now the linux user mode NFS erver (which is
what I run) has a uid/gid remapping facility”.
I have never used the user mode server; I always use the kernel server.
I guess most other people also always use the kernel server.
I believe - but I’m too lazy to check the facts - that it is better to
use the kernel server and you should not use the user mode server in
general.
On 2013-04-23 11:46, Dave Howorth wrote:
> Carlos E. R. wrote:
>> That feature is news to me.
>
> Note that the article says “Now the linux user mode NFS erver (which is
> what I run) has a uid/gid remapping facility”.
>
> I have never used the user mode server; I always use the kernel server.
> I guess most other people also always use the kernel server.
Ah… that’s it.
> I believe - but I’m too lazy to check the facts - that it is better to
> use the kernel server and you should not use the user mode server in
> general.
Yes, I think so, too. No facts either.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)