Data transfer in Linux

Please let me know which ports are used for data transfer, as per my understaning in Linux below ports are used for data transfer from windows to Linux.

 ftp 21 
 sftp 22 (Most secure Port)
 telnet 23

any other port?

wheather we can change the port no 22 to any other port no for a particular user only and how?

To change ports SSH ports, first edit as root, the sshd configuration file.

vi /etc/ssh/sshd_config

Then edit the line which states 'Port 22' and choose an appropriate port not already used on the system.

Doing this, you must be aware that some ports should NOT be used (0 through 1023) and better avoid those from 1024 through 49151. Pick up one from 49152 through 65535 and you'll be fine for now.

Last, restart SSH :

/etc/init.d/ssh restart

And then see if SSH is listening on the new port (Port number now needs to be declared).

ssh username@hostname.com -p 49951

Port redirection may also be an option (see in your router). I don't know what you're aiming at. Could you be more specific ?

Thanks Vincent72 for quick reply but my requirement is ,I have to allocate different port no for ssh for specific user only, other users will continue with port 22 only. how to achieve this?

Just add additional port(s) in the config file sshd_config

As per manual page.

Port     Specifies the port number that sshd(8) listens on.
            The default is 22.  Multiple options of this type are permitted.  See also
             ListenAddress.
.....
             If port is not specified, sshd will listen on the address and all
             prior Port options specified.  The default is to listen on all
             local addresses.  Multiple ListenAddress options are permitted.
             Additionally, any Port options must precede this option for non-
             port qualified addresses.

It is a good thing to read those.

Regards
Peasant.

Not sure to understand... Let's say you have user1's SSH port set on 49592 on his machine. That means you can reach him by ssh on this port. Other users on the network will remain accessible on port 22.

To be more specific, are you trying to reach one user in particular from outside of the network at a specific port or are we talking of doing so from the same network ?

Say user A,B,C should be able to connect ssh only on port 22,

user D will be able to connect only on port 49592 for ssh ,not able to connect on port 22,

From network A to network B or within the same network ?

can you please suggest for both?

The solution I described in my first post works from the same network with user D having a different port configuration.

Then again, if you want to connect to him from outside of the network, you'll have to configure port redirection in your router.

Let's say user D has lan IP : 192.168.0.10, you'd have to configure a port redirection so incoming requests get redirected to the relevent port at this address.

Additionnally, you can configure your internal ssh server to listen on multiple port numbers, so you can still use port 22 internally.

In /etc/ssh/sshd_config you'd have something like :

Port 22
Port 49952

Meaning you can still use port 22 internally and use the second one to connect to this server from the outside after setting up the right port redirection in your router.

But I think you can't stop any other, internal user from connecting to this new port...

You can, but you have to define user authentication rules i.e. in /etc/ssh/ssh_known_hosts

To this extent, you really should take a look at the man page and go to the authentication section.

man ssh

Anyway, still not sure what you want to achieve.