Remote Desktop Sharing in Linux Server.

# Remote Desktop Sharing
-------------------------
# Required RPMs:
----------------
vnc-server-4.1.2-9.el5
vnc-4.1.2-9.el5

# Use the following command on graphical terminal
vino-prefrences
# Remote Desktop Prefrences
----------------------------
# Allow other users to view your desktop
# Allow other users to control your desktop
# Ask you for the confirmation
# Require the user to enter this password
Password: *******

# Goto
Applications ---> Accessories ---> VNC viewer
# Enter the destination IP address.

# Remote Connectivity
----------------------
# To connect remote shell use the command
ssh [options] <IP Address/Hostname>
e.g. ssh -l user1 server.praveshsailor.com

# Open SSH Key-based Authentication
-----------------------------------

# Without passphrase
--------------------
# Add the users on your system
useradd user1;passwd user1
# Then login as user1 and use the following commands to generate the public key for authentication.
ssh-keygen -t dsa

Generating public/private dsa key repair
Enter file in which to save the key (home/user1/.ssh/id_dsa): Enter
Created directory '/home/user1/.ssh'.
Enter the passphrase (empty for no passpharase): Enter
Enter same passphrase again: Enter
Your identification has been saved in /home/user1/.ssh/id_dsa.
Your public key has been saved in /home/user1/.ssh/id_dsa.pub.
The key fingerprint is:
67:de:e4:62:46:de:2f:ec:a7:c6:34:58:26:10:b0:27 user1@server.cms.com

# Copy the public key to the destination to which you want to connect by using  public key (without password)
ssh-copy-id -i /home/user1/.ssh/id_dsa.pub user2@192.168.150.55
user2@192.168.150.55's password:

# Now connect to destinated system via ssh & observe the difference
ssh -l user2 192.168.150.55

# With passphrase
-----------------
# Apply the passphrase to the private key
ssh-keygen -f /home/user1/.ssh/id_dsa -p
Enter the new passpharse:
Enter the same passpharse:

# Again connect to the same host via ssh
ssh -l user2 192.168.150.55
------------------------------------------------------------------------------
# If any error occures while connecting through ssh then clear the contents of  file named known_hosts
vi /root/.ssh/known_hosts
delete all the contents
:wq

# Copying files from remote location
-------------------------------------
# Linux system has some commands to copy remote file to local system
rcp : remote file copy
scp : secure copy
rsync : faster & flexible replacement for rcp

# Usage of commands
--------------------
scp 192.168.150.51:/dir/file1 /mnt
# Options:
----------
-r : to enable recursion
-p : preserves times and permissions
-c : compress the datastreams

rsync 192.168.150.51:/dir/file1 /mnt

  • /etc/ssh/sshd_config - OpenSSH server configuration file.
  • /etc/ssh/ssh_config - OpenSSH client configuration file.
AllowUsers root pravesh

DenyUsers suraj root

Disable root Login via SSH
#PermitRootLogin no


Enable a Warning Banner
#Banner /etc/issue


Change SSH Port and Limit IP Binding

Port 300
ListenAddress 192.168.3.25
ListenAddress 62.54.1.5

#14: Use TCP Wrappers
sshd : 192.168.3.20 172.168.23.12

Verify your sshd_config file before restarting / reloading changes:
# /usr/sbin/sshd -t

Comments

Popular Posts

Install and configure rsyslog Centralized logging server in CentOS

How to fix postfix/smtp Network is unreachable error

Could not join realm: Necessary packages are not installed: sssd-tools sssd libnss-sss libpam-sss adcli