Tuesday, May 20, 2014

Removing password from ruTorrent



When we used script to install rutorrent in the server, it automatically create a file to protect not only your seedbox directory but also each directory of your server. It is good but it is not our main intention. Our purpose is to protect only /rutorrent directory so that no one can use it without you. This automatic script protects every directory in your server which is not good in some aspects. Suppose, if you create a directory called "test", then you have to provide username and password of ruTorrent to access this newly created folder. In this tutorial I will show you how to remove password protection from each directory without /rutorrent (seedbox) directory.


Procedure: 

1. After installing ruTorrent by script, navigate to this directory with your favorite FTP client (Exm: FileZilla)  and edit config.php file
/var/www/rutorrent/conf/users/<your username>

2. Copy entire $scgi_host link. Example:
unix:///home/<your username>/rtorrent/session/rpc.socket

3. Now navigate to this directory & edit config.php
/var/www/rutorrent/conf

4. Uncomment (remove double black slash) from the beginning of those lines
$scgi_port = 0;
$scgi_host =

5. Paste your copied host link (from step 2) after $scgi_host =. Example:
$scgi_host = "unix:///home/<your username>/rtorrent/session/rpc.socket";
Now save this file.

6. Now go to
/home/<your username>/.autodl/
directory & edit autodl2.cfg or autodl.cfg. Note gui-server-port & gui-server-password to somewhere else.

7. Again go to
/var/www/rutorrent/plugins/autodl-irssi
 
8. Rename _conf.php to conf.php & edit this file.

9. In $autodlPort, put gui-server-port instead of 0 which copied from step 6. Exmple:
$autodlPort = 23875;

10. In $autodlPassword, put gui-server-password (which was copied from step 6) between inverted commas. Exmple:
$autodlPassword = "hash password/password here";
Save this file.

Done! Your password is now removed from each directory including /rutorrent directory. Your seedbox is now unsecure because this process remove the password of your seedbox directory too. Let's secure the seedbox directory to avoid unauthorized access.


Adding htaccess passoword for /rutorrent directory:

1. Generate username & password for your seedbox from here
http://www.htaccesstools.com/htpasswd-generator/
In username & password field, put your desire username & password. You will get a generated one line code.

2. Create an empty file named .htpasswd and put the generated code here and save it.

3. Put this file (.htpasswd) to the following directory.
/var/www/rutorrent/

4. Now go to your nginx configuration file (nginx.conf) and edit it.

5. After location / block, add a new location for /rutorrent like this
               
location /rutorrent {
               root /var/www;
               auth_basic "ruTorrent Seedbox";
               auth_basic_user_file /var/www/rutorrent/.htpasswd;
                     }

So, the entire code will be
location /
            {
            root /var/www;
            index index.php index.html index.htm;
            autoindex on;
            }

location /rutorrent
           {
            root /var/www;
            auth_basic "ruTorrent Seedbox";
           auth_basic_user_file /var/www/rutorrent/.htpasswd;
           }

6. Now remove the following two lines under server { block
           auth_basic "ruTorrent Seedbox";
           auth_basic_user_file "/usr/local/nginx/rutorrent_passwd";

Example:
Before:
server {
         listen <listen address/IP>;  
         server_name <listen address/IP>; 
        auth_basic "ruTorrent Seedbox";
         auth_basic_user_file "/usr/local/nginx/rutorrent_passwd";

After:
server {
         listen <listen address/IP>;  
         server_name <listen address/IP>;

Now save this configuration file and restart nginx server. Voila!! Your rutorrent seedbox is now protected.

No comments:

Post a Comment