Archive for June, 2008

Deny root user for ssh

We can deny root user for ssh. For this we have to edit the sshd-config file. To do this we have to write the following command:

vi /etc/ssh/sshd-config

Now we will find out a line

PermitRootLogin=yes

We will replaced the yes with no.

PermitRootLogin=no

Now not only the root, but also all super user can not ssh at this ssh server.

To allow any user we have to add the following line at the last line of the configuration.

AllowUsers reza

This command will allow reza user.

AllowUsers reza nayem

This command will allow reza and nayem, both users.

We must have to restart the service after editing the file. Otherwise it wont work.

Any advice regarding this issue is highly expected.

Advertisements

Leave a Comment

Changing the port number at ssh

We can change the port number of ssh. By default the port number of ssh is 22. To change the port address we have to edit the file /etc/ssh/sshd-config. We can do this with the following command.

vi /etc/ssh/sshd-config

In this file we will find a line

port 22

We will replace the 22 with 29 and then save the file.

Now we will restart the service sshd.

service sshd restart

/etc/init.d/sshd restart

Now to ssh at this server or os we have to write the following line

ssh -p 29 root@192.168.100.5

Leave a Comment

Logging at a server with ssh

We can log in at a server or pc with ssh. For this here is some instruction.

1. Suppose we are at 192.168.100.1 and trying to ssh at 192.168.100.5 .

ssh 192.168.100.5

This command will try to connect the 192.168.100.5 as the user that he already logged in the 192.168.100.1. Suppose we are at the root user in the 192.168.100.1. Then the command will try to connect at 192.168.100.5 as the root user.

2. ssh reza@192.168.100.5

This command will try to ssh at 192.168.100.5 as the reza user.

3. ssh -l nayem 192.168.100.5

This command will try to ssh at 192.168.100.5 as nayem user.

4. ssh -p 29 root@192.168.100.5

This command will try to ssh at 192.168.100.5 using the port 29.

Thats all my knowledge about this issue. Expect to get any advice from you.

Comments (3)

service start-up configuration

We almost everyone know about the start-up configuration at operating system. The operating system starts the services from start-up configuration while the OS starts. At Linux the same thing happens.

To check whether a service is at start-up configuration we can use the following command

chkconfig –list sshd

This command will show the start-up configuration for the sshd service.

We can add any service at startup in many ways.

1. chkconfig sshd on

With this command the service will start only in that run level in which the OS is running now. Suppose the OS is running on run level 3, then this command add the sshd service at startup of run level 3.

2. chkconfig –level 35 sshd on

This command sets the sshd to start at run level 3 and 5.

3. We know that for every run level there are files. Suppose for run level 3 there is a file /etc/init.d/rc3.d .

Here we will find some files that starts their name with either K or S . Starting with K means the service is not at startup config. S means it will start automatically.

If the sshd service is not setup at run level 3, then we will find a file K20sshd . If we rename the file S20sshd, then sshd service will be set for run level 3.

mv K20sshd S20sshd

Wish to get any comments and better advice from you.

Leave a Comment

Packages for ssh at Linux & Starting the service

openssh-server This package is for configuring the ssh at the server pc.

openssh-client This package is for configuring the ssh at the pc that will try to connect to other with that configuration.

We can check with the following command whether the packages are installed or not.

rpm -qa | grep openssh-server

We can install the packages with the following command.

rpm -ivh openssh-server

rpm -ivh openssh-client

Then we have to start the service with the following command

service sshd start

/etc/init.d/sshd start

At Debian we have to install with the following command

apt-get install ssh

At Debian after installing a package, the service starts automatically.

To start the ssh service at any time at Debian we have to use the following command

/etc/init.d/sshd start —- starts the service

/etc/init.d/sshd restart —- restarts the service

/etc/init.d/sshd stop —— stops the service

/etc/init.d/sshd reload —– reloads the service

Leave a Comment

Secure Shell

Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel encryption provides confidentiality and integrity of data over an insecure network, such as the internet. SSH uses public key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary. between two computers.

SSH is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding arbitrary TCP ports and X11 connections; it can transfer files using the associated SFTP or SCP SSH uses the client server protocol.

An SSH server, by default, listens on the standard TCP port 22.

An SSH client program is typically used for establishing connections to an SSH daemon accepting remote connections. Both are commonly present on most modern operating system, including Mac OS, Linux, FreeBSD, Solaris and OpenVMS. Propriatary, freeware and open source versions of various levels of complexity and completeness exist.

Leave a Comment

Changing MAC Address at an interface at Linux

Suppose we want to change MAC address of an interface eth0 . Here at first we have to remind three steps. These are:

1. Disable the interface with the following command.

ifdown eth0

2. Change the MAC address with the following command.

ifconfig eth0 hw ether 00:21:D3:C1:11:33

3. Enable the interface with the following command.

ifup eth0

Wish to get advices regarding this issue.

Leave a Comment

« Newer Posts · Older Posts »