How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

January 15, 2019

MySQL database exists on the server, but does not show up in the cPanel

Filed under: Linux — Tags: , , — admin @ 2:22 pm

I have created a database manually on server with user_dbname however won’t show up on cpanel / phpmyadmin .

The solution was to run this

/usr/local/cpanel/bin/dbmaptool cpanelusername --type mysql --dbs 'nameofdatabase' --dbusers 'dbusername'

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

Powered by WordPress