LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SFTP server port blocked on Uni network, need to change the listening port. (http://www.linuxquestions.org/questions/linux-newbie-8/sftp-server-port-blocked-on-uni-network-need-to-change-the-listening-port-839584/)

sammyboy161 10-21-2010 11:42 AM

SFTP server port blocked on Uni network, need to change the listening port.
 
Hey guys,

VERY new to linux, erm but I have an issue that needs solving!

I recently moved to university, where their network blocks sftp port 22, this means that I cannot connect to my FTP server which is running a version of linux.

Now I've got this ftp server connected to a seedbox and it was created using the following walkthrough..
Code:

I have written this guide for a friend, but I though it would be useful for others as well.

There are several guides floating around, but I found that most always cock up in some way. This one is tried and tested to work on Debian Etch (on an OVH rps, but should apply to most servers).

If there is a new stable release of rtorrent/libtorrent then I will update this guide to show you how to update it (without reinstalling the whole server).

At the bottom there are also instructions to install ftp access & some network monitoring software



Login to your server as root (with putty), then enter:



passwd




Change you password (try this generator to get something secure), then enter:



apt-get install sudo ntp



 

apt-get update && apt-get upgrade

reboot




Log back in. Next sort out the time:



/etc/init.d/ntp stop && ntpdate pool.ntp.org && /etc/init.d/ntp start


If you get an error just skip it.



FOR OVH USERS: Lets just remove their support access for security:



rm /root/.ssh/authorized_keys2





Install all the software:



http://pastebin.com/f64c94716


(Copy and paste the code from that link into putty, not the actual link)



Create the rtorrent user:



adduser rt




Follow the instructions (& remember the password), then:



visudo




Now change:

 

root ALL = (ALL) ALL




To:



root ALL = (ALL) ALL

rt  ALL = (ALL) ALL


To save press Ctrl+O, follow the instructions, then exit with Ctrl+X.


Logout (with "exit"), then start putty again and login with the new user "rt".



Install xmlrpc-c:

 

cd

svn co https://xmlrpc-c.svn.sourceforge.net...rpc-c/advanced xmlrpc-c

cd xmlrpc-c/

./configure --disable-cplusplus

make && sudo make install


You'll need to re-enter you password for that last line.


Now libtorrent:



cd

wget http://libtorrent.rakshasa.no/downlo...-0.12.5.tar.gz

tar zxvf libtorrent-0.12.2.tar.gz

cd libtorrent-0.12.2

./autogen.sh

./configure

make && sudo make install




Then rtorrent (that odd configure line is important!):



cd

wget http://libtorrent.rakshasa.no/downlo...t-0.8.5.tar.gz

tar zxvf rtorrent-0.8.2.tar.gz

cd rtorrent-0.8.2

./autogen.sh

./configure --with-xmlrpc-c

make && sudo make install





Moving on to wtorrent:



cd /var/www

svn co svn://wtorrent-project.org/repos/trunk/wtorrent/

cd wtorrent

sudo mv * ..

sudo mv .* ..

(ignore the little error it makes)

cd ..

sudo rm -r wtorrent

sudo touch ./db/database.db

sudo chown -R www-data:www-data db torrents tpl_c

sudo nano conf/sample.user.conf.php


Edit this to suit your needs, set RT_AUTH to true and put your username and password for the rt user (what you should be logged into at the moment) into 'RT_USER' 'rt' and 'RT_PASS' 'the password'.

Also don't forget to change 'DIR_EXEC' to '/var/www/' & 'DIR_DOWNLOAD' to '/home/rt/torrents/doing/'.

Save & close with Ctrl+O then Ctrl+X.


Rename the file:



sudo mv conf/sample.user.conf.php /conf/user.conf.php





rtorrent needs some folders:



cd

mkdir ./torrents

mkdir ./torrents/watch

mkdir ./torrents/doing

mkdir ./torrents/done

mkdir ./.rtsession





Sort out the config files:



cd

wget http://flipsidereality.com/blog/wp-c...-howto.tar.bz2

tar xvfj rtorrent-howto.tar.bz2

cd rtorrent-howto-files

sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.dist

sudo cp rtorrent /etc/init.d

sudo chmod a+x /etc/init.d/rtorrent

sudo update-rc.d rtorrent defaults 25





Some more config files:



cd

sudo nano .rtorrent.rc


Go to http://pastebin.com/f759d9bb9 and copy what is in the file into the terminal (to paste in putty right click).

Save & exit as normal.


Next:



sudo nano /etc/lighttpd/lighttpd.conf


Do the same as before, copy this in: http://pastebin.com/f4bc19085

Save & close.



Get a few rights right... :

 

sudo usermod -aG tty rt

sudo chown rt:rt /home/rt -R

sudo chmod 777 /home/rt/torrents -R





Finally:



sudo /etc/init.d/lighttpd restart

sudo /etc/init.d/rtorrent start





Now visit in firefox:

 

your servers ip/install.php




Fill it with the details, then once that has run, remove the install file in putty with:



sudo rm /var/www/install.php





Visit: your-servers-address, enjoy

(login with the details you entered in the install.php page)

If you have any issues feel free to PM me.



To install ftp access:

Use filezilla, login with the sftp method and the rt users details.

This transfers files over ssh, so no need for an ftp server. It is also much more secure, ideal for such a application.



Network Statistics

If you would like to record and view your servers network activities then follow what's below.

Install vnstat:



sudo apt-get install vnstat

sudo vnstat -u -i eth0


You can replace "etho" with the interface that you wish to monitor.

Install the front end:



cd /var/www

sudo mkdir stats

sudo wget http://www.sqweek.com/sqweek/files/v...d-1.4.1.tar.gz

sudo tar -zxf vnstat_php_frontend-1.4.1.tar.gz -C stats

cd stats/vnstat_php_frontend-1.4.1

sudo mv * ..

sudo rm -rf vnstat_php_frontend-1.4.1

sudo chown -R www-data:www-data /var/www/stats



Then edit the following file:



sudo nano /var/www/stats/config.php


Remove what's there and paste in this: http://pastebin.com/f692df5f6
Change "$iface_list = array('eth0');" & "$iface_title['eth0'] = 'Internet';" if you use a diffrent interface.

Visit: your-servers-address/stats

Im not sure whether that helps, I just imagined that knowing what ive got installed, and Im hoping people can work it out from that, would help.

Basically, I would really like someone to be able to construct the commands on how to change the listen port for sftp connection on linux or add another port to the list that Linux would use so that I could put in through putty.

Many thanks,

Sammyboy161

TB0ne 10-21-2010 11:58 AM

Quote:

Originally Posted by sammyboy161 (Post 4134937)
Hey guys,

VERY new to linux, erm but I have an issue that needs solving!

I recently moved to university, where their network blocks sftp port 22, this means that I cannot connect to my FTP server which is running a version of linux.

Now I've got this ftp server connected to a seedbox and it was created using the following walkthrough..

Im not sure whether that helps, I just imagined that knowing what ive got installed, and Im hoping people can work it out from that, would help.

Basically, I would really like someone to be able to construct the commands on how to change the listen port for sftp connection on linux or add another port to the list that Linux would use so that I could put in through putty.

While we understand your dilema, as a rule we cannot (nor should we), provide information on how to 'get around' security rules of any organization. They're there for a reason.

Two possible solution: one is talking to the university, and see what is acceptable to do on their network. The second is to read the man page on sshd_config.

Tinkster 10-21-2010 12:03 PM

And closed per the above post. The request is against LQs explicit rules.


All times are GMT -5. The time now is 03:19 AM.