How to , and other stuff about linux, photo, php … Another blog just like others on internet

March 20, 2014

Create an FTP user on a cPanel server from shell

Filed under: Linux — Tags: , , , , , , — admin @ 11:18 am

Well today I wanted to make a script to automatically create some user for an account from shell, that’s because they where to many to make them manually from cpanel/whm . Also this command work on your server even if you have pure-ftpd or proftpd ) , because the cpanel keep the virtual user information into /etc/proftpd/ ( also there is a all user/password into /etc/proftpd/passwd.vhosts ) .

So , how to add a ftp user from shell ?
Well the syntax is :
/usr/local/cpanel/bin/proftpd_passwd -a ::::::

So first of all we have to know the uid and gid for this we can grep the passwd file.
grep /etc/passwd

Example how to add a username for matrafox system user :
grep matrafox /etc/passwd
matrafox:x:xxx:yyy::/home/matrafox:/usr/local/cpanel/bin/noshell
/usr/local/cpanel/bin/proftpd_passwd matrafox -a testuser:testpassword:xxx:yyy:matrafox:/home/matrafox/public_html:/sbin/nologin

If you want to detele a user the syntax is:
/usr/local/cpanel/bin/proftpd_passwd -d

Also if you manually edit a file you should run also the command so changes to take effect :
/usr/local/cpanel/bin/ftpupdate

March 2, 2012

proftpd passive port not working

Filed under: Linux — Tags: , , , , — admin @ 12:20 pm

Well, we have to check a proftpd why was not working in some case.
Here are some error output:
227 Entering Passive Mode (10,108,211,224,191,201).
ftp: connect: Connection timed out

Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is the current directory
Command: TYPE I
Response: 200 Command okay.
Command: PASV
Response: 227 Entering Passive Mode (172,30,255,230,229,148)
Status: Server sent passive reply with unroutable address. Using server address instead.
Command: MLSD
Error: Connection timed out
Error: Failed to retrieve directory listing

Well from here look like passive mod not working ok.
I know that I open the port from firewall , for passive range. However this still was not working.
So it appear that when you are using passive mod, you have to use also and the masqueradeaddress section on proftpd.

So basically you should have something like this:
ServerName "your server name"
PassivePorts 49000 50000
MasqueradeAddress name.ofserver.com

Or you may use your routable ip on masqueradeaddress .
And not forget to open 49000:50000 range port in firewall.

February 29, 2012

Standalone vs inetd

Filed under: Linux — Tags: , , , , , , — admin @ 11:34 am

What to use ?
Inetd or standlone server ?
Well I personally chose standalone, however if you have a server with low resources, and a service that you want to run from time to time, then you should go with inetd.

Inetd only spawns the process when it is needed, so the process does not consume resources when no one is using it. However, there is an overhead on each connection as inetd spawns a new process to handle it.

So if you have a heavy used service go with standalone.

Powered by WordPress