Gangmax Blog

find, tar, samba & sshd

Today I get a mission: login a remote solaris server and get some log files to my local environment to do some analysis. A special point is: I have to use my Windows VirtualBox instance of my Ubuntu 10.04 desktop, to access the server because I have to use a VPN client to access the server, and the VPN client only works in Windows.

The first step is using putty to ssh the server and get the compressed log files, the commands are:

1
2
3
cd /app/glassfish/nodeagents/node-agent1/instance1/logs
find . -type f -mtime +2 -mtime -5 | xargs tar cf log.tar
gzip log.tar

Notes:

  1. The second line means: get the modified log files between 5 days ago and 2 days ago and “tar” them in a single “log.tar” file;
  2. the “cf” parameters in the second line: the linux version “tar” has “z” parameters which means doing compression while the solaris version “tar” doesn’t have;
  3. The third line means compress the “log.tar” file to a “log.tar.gz” file, the “log.tar” file will be removed automatically after the compression finishes successfully.

The I have to figure out a way to copy the tar files from the VirtualBox Windows instance to the hosting Ubuntu desktop. First I want to use samba with the following steps:

1. Alt-F2 and run "shares-admin", add "home/gang/share" as the shared folder; 2. Edit the file "/etc/samba/smb.conf" by uncommenting the line "# security = user" and save; 3. Go to another computer and access the following URL in a Nautilus window: smb://your-username@host/folder-name [Refer here]

Then I find I don’t know how to use a samba client in Windows. Then I use ssh to do so:

  1. Make sure “sshd” service is running in the hosting Ubuntu desktop;
  2. In the VirtualBox Windows instance, open “WinSCP” in which you can access the hosting ubuntu;
  3. Copy files.

That’s it.

The tar commands usage refers here.

Comments