Tuesday, 14 February 2017

SCP secure copy directly between linux machines

SCP : secure copy directly between linux servers. SCP runs on port 22 by default.

server1 = 192.168.0.10
server2 = 192.168.0.11


Syntax : scp -[options] username@server1:/path  /local_path

Options :

p = Speed of connection
r = Recursive
v = Verbose details
C = Compression
l = Bandwidth Limit (l -500)
p= Port

root@server2:/tmp# scp -pr root@server1:/root/test /tmp
test1                                         100%    0     0.0KB/s   00:00
test2                                         100%    0     0.0KB/s   00:00


Friday, 2 December 2016

Password less authentication in linux

Source : host A
Destination: host B


1. Run the below command for generating public and private key( host A)

ssh-keygen -t rsa

/home/username/id_rsa (private key)
/home/username/id_rsa.pub (public key)

2. ssh-copy-id -i  /home/username/id_rsa.pub host_B_ip_address



Alternate way:

* Copy the text inside id_rsa.pub file .

* Login into host B and go to /root/username/

and create new file "authorized_keys" and paste text copied from step 2.

*  Login into Host A to Host B password less.(ssh host B)


Simple:

Put public key(host A) to authorized_keys(host B)

Now Host A can login into host B without any password.



Tuesday, 18 October 2016

ffmpeg merge audio video

ffmpeg merge audio video:

Input file : song.mp3 , video.mp4
Output file : output.mp4


ffmpeg -i song.mp3 -i video.mp4 -acodec copy -vcodec copy -f mp4 output.mp4


If your audio or video stream is longer, you can add the -shortest option so that ffmpeg will stop encoding once one file ends.

ffmpeg -i song.mp3 -i video.mp4 -acodec copy -vcodec copy -f mp4 -shortest output.mp4