Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Sunday, July 6, 2014

Unix Commands : Tricks and Tips


  1. Update a file into a JAR file

I want to update the application.properties file in myproject.jar file.

jar -uf myproject.jar application.properties

This command will update application.properties in myproject.jar
Note that for -u  application.properties must already exist in the jar file, and will only be overwritten if it's newer than the one in the jar.

Sunday, June 22, 2014

Passwordless SSH and SCP to Unix Server

In this article we will see how we can do SCP and SSH to remote server without giving any password. 
This helps while we are writing a bash script for doing ssh and scp.

Run this command on LocalMachine
$ ssh-keygen -t dsa

Add following lines to your .bash_profile on your LocalMachine:
# So that ssh will work, take care with X logins - see .xsession
[[ -z $SSH_AGENT_PID && -z $DISPLAY ]] &&
exec -l ssh-agent $SHELL -c "bash --login"

Run these command on LocalMachine
$ ssh-copy-id RemoteServer
$ scp ~/.ssh/id_dsa.pub RemoteServer:.ssh/id_dsa.pub.LocalMachine

Run these command on RemoteServer
$ cat ~/.ssh/id_dsa.pub.LocalMachine >> ~/.ssh/authorized_keys
$ rm ~/.ssh/id_dsa.pub.LocalMachine
$ chmod 600 ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh

After executing the above commands we will be able to SCP or SSH to RemoteServer from LocalMachine.

Sunday, June 15, 2014

SCP file TO and FROM remote server

1) To copy the files from remote server to local machine
>> scp user@from-host:source-file local-destination-folder

from-host :-> Hostname from where we want to copy the files
source-file  :-> File that we want to copy
local-destination-folder :-> Local folder where we want to copy the files


2) To copy files from local server to remote server
>> scp source-file user@to-host:remote-destination-folder

source-file :-> File that we want to copy
to-host :-> Hostname where we want to copy the files
remote-destination-folder :-> Exact folder on remote machine where you want to copy the files

3) To copy the folder.
>> scp -r 

-r :-> This Parameter is to copy the folder.

Password Protected Solr Admin Page

As we all know Solr Admin Page is not password protected and anyone can get into Solr Admin Page. However this article will ...