Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

Tuesday, February 5, 2008

Moving SVN repository to another machine

SVN is a great tool for collaborated programmer to keep every copy files up to date and track changes made by everyone. In my case, I use SVN for synchronize my working file between my workstation and portable one. If you haven't get the SVN installed, follow the instruction given from the SVN site. For Ubuntu user (like me) there's a useful instalation guide here.
Since it's a collaboration tool across the internet, SVN repository supposed can be move from one server to another. Even the server are using different OS. First, you need to dump current repository to a dump file (assummed you have existing repo at /opt/svn/svnrepo/) :

$svnadmin dump /opt/svn/svnrepo > svnrepo.dump

Make the file smaller by compressing it :

$tar -cvzf svnrepo.tar.gz svnrepo.dump

Then transfer the file to new server using SCP (assummed your SSH using different port number 222) :

$scp -P 222 svnrepo.tar.gz username@server2:/home/username/

Once transferred, login to server2 :

$ssh username@server2 -p 222


Extract the dump file and copy to new location (assummed at /opt/svn/svnrepo/)

$tar -xvzf svnrepo.tar.gz
$mkdir /opt/svn/
$mv svnrepo.dump /opt/svn/

Import dump file into running SVN server :

$svnadmin create svnrepo
$svnadmin load svnrepo < face="verdana">Once you complete the step, you can delete the .dump file and the tar.gz file as well.
When running the SVN server make sure it loads repo from the location we just imported by

$svnserve -d -r /opt/svn/svnrepo/

Dont forget on SVN client side, make sure to relocate repo to new location as well

Sunday, January 20, 2008

Using ssh, scp, sftp without password

SSH is a remote access protocol that designed for security purpose, replacing non-secured Telnet. As it main strong point is its security, there's both side signature and authentication to establish a connection. And also, if you notice, most SSH clients didnt offer a "remember password" option and always been asked for password each time you want to connect.

But on linux you can set the connection establish itself without prompting for password. This quite useful if you very often connect to a server. I assuming connecting from LOCAL to SERVER.

1. Log on to LOCAL computer. Run following command :
$ ssh-keygen -t dsa
Left the field empty (press enter to accept the value)
As this step complete, there are 2 file created in your home ~/.ssh/ folder
id_dsa.pub --> this is your public key
id_dsa --> this is your private key

2. Merge the public key into SERVER's authorized key. First we need to transfer the file first using SCP. Add -P option if your SERVER user other port than default SSH port 22.
$ scp ~/.ssh/id_dsa.pub user@SERVER:/tmp
Then, log on to SERVER for further step by
$ ssh user@SERVER -p port_number
Change the port number to a value of your SSH port. If you dont know you may try 22.

3. As we logged on SERVER, merge the public key into authorized_key2 :
$ cat /tmp/id_dsa.pub >> ~/.ssh/authorized_key2
Now you can delete the public key :
$ rm /tmp/id_dsa.pub

4. Now you can SSH, SFTP or SCP to SERVER from LOCAL computer without get prompted by password.

For security reason, please apply this for trusted computer only.