Friday 23 March 2012

SSH login without password in linux

You can login to a remote Linux server without entering password using ssh-keygen.

Create public and private keys using "ssh-keygen" on local-host. ssh-keygen have two algorithm  tsa and rsa.


 root@manivel-admin:~#   ssh-keygen   -t  rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): -->Press Enter
Enter passphrase (empty for no passphrase):  --------->    Press Enter
Enter same passphrase again:                     ------------->   Press Enter
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
94:94:60:5a:5f:e8:ef:7f:6d:02:3b:f9:88:39:d2:6f root@manivel-admin
The key's randomart image is:
+--[ RSA 2048]----+
|      +..o.      |
|     + ooo       |
|    .  .+        |
|       ..        |
|        S.       |
|          . .    |
|         o   + . |
|        . +oE.o o|
|         .o=++.o |
+-----------------+
root@manivel-admin:~# 

Copy the public key localhost to remote-host using "scp" command.

  root@manivel-admin:~# scp  -r  .ssh/id_rsa.pub  test@10.2.12.1:/home/test/.ssh/authorized_keys

Notes: If  .ssh directory is not there in /home/test/ .You will create .ssh


We need to set permission for .ssh directory and authorized_keys file in "Remote host".

  test@manivel:~$  chmod  755  .ssh/

  test@manivel:~$  chmod  644  .ssh/authorized_keys

Login to remote-host without entering the password

  root@manivel-admin:~#   ssh   test@10.2.12.1
                    [Note: SSH did not ask for password.]

  test@manivel:~$  [Note: You are on remote-host here]

Saturday 10 March 2012

500 OOPS: cannot change directory:/home/user, Login failed on Vsftpd

You want to login ftp server using system user(local or remote) and want to get into home directory of that user.You are trying to connect ftp server but getting below error



Above error occurs when SELinux is Enforcing mode.First you need to check SELinux status using below command.

[root@localhost ~]# getenforce
Enforcing

You need to change SELinux mode Enforcing to Permissive mode

 [root@localhost ~]# setenforce  0

Now check again SELinux status

  [root@localhost ~]# getenforce 
  Permissive

Now you can able to login ftp server using user (ftp-user) and check user home directory using "pwd" command


If you want to access remote machine via ftp then Disable Firewall and SELinux. 

Friday 2 March 2012

Making ISO file on command line using "mkisofs"


Single directory to iso file
 # mkisofs -o   test.iso   test/
output would like this
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
5765 extents written (11 MB)
Multiple directory to iso file
# mkisofs -o   test.iso   test/  test1/  test2/