If you will face this problem when connecting through ssh:
SSH exchange identification: Connection closed by remote host.
Maybe your server was under a brute force attack.
To solve this problem in an easy way you could install denyhosts.
On Centos server yum install denyhosts.
Edit /etc/hosts.allow and insert the IP that you never want to block.
Edit /etc/denyhosts.conf and check your distribution default conf.
After that, simply start denyhosts
service denyshosts start
Stay tuned.
Saturday, April 5, 2014
SSH exchange identification: Connection closed by remote host [Solved]
Read more...
Friday, June 14, 2013
[Solved] Vsftpd with chrooted users not restart on Ubuntu 12.04
If you face this error on your Ubuntu 12.04
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Once edited the /etc/passwd to chroot the user with /bin/rbash and after changed permissions on the directory that will be the ftp home directory of the user, to enable vsftpd without errors on starting the service you need to follow the steps below:
1) wget http://http.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-3_amd64.deb
2) dpkg -i vsftpd_3.0.2-2_amd64.deb
3) echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
4) /etc/init.d/vsftpd restart
Now you will be able to restart your vsftpd service without any other issue.
Once edited the /etc/passwd to chroot the user with /bin/rbash and after changed permissions on the directory that will be the ftp home directory of the user, to enable vsftpd without errors on starting the service you need to follow the steps below:
1) wget http://http.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-3_amd64.deb
2) dpkg -i vsftpd_3.0.2-2_amd64.deb
3) echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
4) /etc/init.d/vsftpd restart
Now you will be able to restart your vsftpd service without any other issue.
Read more...
Sunday, April 7, 2013
Linux adduser user@domain.tld with @ or . inside the userid and use it as an FTP account
If you want to add a new user to your linux box and it not contains any special char like an '@' or '.' there is no problem. In the other case you could not find an answer simply googling around. For this reason i have to make some tests on different kind of server (dedicated and vps ones).
Via plesk or others gui i didn't find a way to add user with special chars inside the username, also via shell i had some problems with that.
The final solution for me was using webmin or follow the instructions below:
# groupadd ftpusers
# adduser 1234455 -d /home/1234455 -G ftpusers
# passwd 1234455
# type and retype password
# chown 1234455:ftpusers /home/1234455/
Well, now you have a user without @extdomain.tld so to do that you have to modify two files:
/etc/passwd
/etc/shadow
edit in passwd:
old one
1234455:x:10005:505::/home/1234455:/bin/false
new one
1234455@extdomain.tld:x:10005:505::/home/1234455:/bin/false
edit the same in the shadow and be carefull when do that.
After doing these hacks you could access to your home directory via ftp using 1234455@extdomain.tld :)
Read more...
Thursday, November 1, 2012
[SOLVED] My website is unreachable but SSH still works Centos Linux
Hi all,
if suddenly your websites becomes unavailable
If you could reach your IP but not your website, then there's something wrong - maybe - with DNS configuration or FIREWALL rules.
If you reviewed your DNS configuration and you tried to restart dns service through:
service named restart
with no success, maybe the problem could be the linux firewall iptables.
So, type these 2 line into your bash
service iptables stop
nano /etc/sysconfig/iptables
To check if the server accept incoming connection on the 80 port and 443 port (http and https) you have to verify the iptables config files in /etc/sysconfig/iptables.
# Generated by iptables-save v1.4.7
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:2600]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed
If port 80 and 443 not exists you have to add these two lines to your VPS iptables config file and it will accept new incoming connection.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Now type in your console:
service iptables start
Now you could check if your website is again available and reachable through the 80 and 443 port.
This works fine on RedHat Centos Linux distribution.
If you have problem listing your directory via FTP so type this in your ssh:
Stay tuned.
if suddenly your websites becomes unavailable
s or unreachables instead your IP/SSH still works than you could try this tricks that works for me in some situations on redhat Centos.If you could reach your IP but not your website, then there's something wrong - maybe - with DNS configuration or FIREWALL rules.
If you reviewed your DNS configuration and you tried to restart dns service through:
service named restart
with no success, maybe the problem could be the linux firewall iptables.
So, type these 2 line into your bash
service iptables stop
nano /etc/sysconfig/iptables
To check if the server accept incoming connection on the 80 port and 443 port (http and https) you have to verify the iptables config files in /etc/sysconfig/iptables.
# Generated by iptables-save v1.4.7
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:2600]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed
If port 80 and 443 not exists you have to add these two lines to your VPS iptables config file and it will accept new incoming connection.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Now type in your console:
service iptables start
Now you could check if your website is again available and reachable through the 80 and 443 port.
This works fine on RedHat Centos Linux distribution.
If you have problem listing your directory via FTP so type this in your ssh:
iptables -A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
Stay tuned.
Read more...
Sunday, November 20, 2011
Drupal 6 Pages and Feed RSS: set the offset and item's pagination.
If you have to change dinamically the number of items that are displayed on your feed page or do you need to set their offset via Drupal 6 Feed Rss Views Module, than this post could helps.
After googling for a couple of hours without find any solution to this issue, i tried to solve it by myself.
I would like to pass custom number of items and their offset as arguments of an url.
Something like this
http://www.yourdrupalwebsite.com/rss.xml?items-limit=5&items-offset=5
This page is a custom feed page created by the drupal's admin side .
/admin/build/views/edit/(rss-feed) (in my case)
After that you'll have to use this little hack that change a little piece of code inside the file
modules/views/plugins/views_plugin_display.inc
I found this piece of code on the line 1861. So i changed the following default settings:
$this->view->set_pager_element($this->get_option('pager_element'));$this->view->set_items_per_page($this->get_option('items_per_page'));
$this->view->set_offset($this->get_option('offset'));
and i replaced them with:
$this->view->set_items_per_page(($_GET['items-limit'] > 0) ? $_GET['items-limit'] : $this->get_option('items_per_page'));
$this->view->set_offset(($_GET['items-offset'] > 0) ? $_GET['items-offset'] :$this->get_option('offset'));
Save the file and you'll be ready to call your feed page with your custom arguments with it.
http://www.yourdrupalwebsite.com/rss.xml?items-limit=5&items-offset=5
and check the response.
Note:
You need to filter and sanitize your $_GET input values for security reasons.
Enjoy
Read more...
Subscribe to:
Posts (Atom)
