Change Mysql User Password Via Shell?
Anyone know the commands to change a MySQL user's password via ssh?
I found stuff for changing the root password, and tried to adapt it for the user, but it didn't work.
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
How To Execute Shell Scripts As Some User
I'm trying to write some scripts that automate the installation of a website with a content management system. This includes creating domains, installing databases etc via plesk API. Now we have it creating the domains and databases via plesk, this is not the issue. It's permission problems issuing commands on the server. I need to have the script install the cms and this requires writing files to a folder on the server owned by a user which is created with the domain. e.g. user creates timsdomain.com with ftp user name tim Plesk makes directory on webserver called ~/vhosts/timsdomain.com/ inside this directory is a folder called httpdocs. All the files within this folder are owned by tim. Now my script (running as 'apache' in a folder owned by 'admin') needs to write/edit files to this directory as the user tim (or whatever user was created when the domain was set up). How can I do this from a php script? My idea would be to log in as the new user and then start issuing commands but I don't know how to login a user from a script. I've tried exec, exec_shell etc trying to log in via script as the new user using sudo/su/suid etc but they all ask for a password (for obvious reasons) but I cannot see a way to send the password to the command with the script. Ssh? Here's some pseudocode that demonstrates what I'm trying to do, if you can think of a better way I'm all ears. Code: //User Fills in CMS/Domain information which becomes Form_Data //uses plesk to create blank domain, create email addresses and empty database Make_Domain(Form_Data) { Plesk = Get_Plesk_Object(); Plesk.Create_Domain(); Plesk.Create_Database(); Build_CMS(Form_Data); } //HERE IS WHERE I AM HAVING TROUBLE: I can't figure out how to change the user so I can install files to a // different directory other than the current user's directory (admin) Build_CMS(Form_Data) { change_to_user(Form_Data.ftp_username, FormData.ftp_password); unpack_CMS_archive_into(user_directory); //eg unpack cms.tar into 'timsdomain.com' (if the above command didn't switch the current directory to users home directory) //initialises CMS config files and installs CMS data to database Run_Install_Scripts_On_Server(Form_Data); //albeit complex, most important part of script Confirm_Tim_Is_Awesome(); } Confirm_Tim_Is_Awesome() { while (getTim().has_moustache()) { echo "<em>You're still awesome. </em>"; }
View Replies!
View Related
Cpanel Password Change
I searched the forum articles but couldn not find specifically what I wanted.. just learning with my dedicated server... I want to change my cpanel password and ftp password but NOT change the msql server password. I tried to do it in WHM it also changes the database to my website and causes it to go down. (so I changed it back) I tried to change it under: [URL to actual WHM removed] Password Modification in WHM but it changed the databse program as well. Again all I want to change is the Cpanel acces and main FTP pass Im doing this to keep old programmers out of my server)
View Replies!
View Related
Changing FTP User Password
I've got an ftp account that was created in the very beginning and now I want to change the password to it but when I log in to my PLESK WINDOWS OS Control Panel and go under ftp accounts, I only see one account on there which is not what I've been using. My questions is, is there another way of locating other ftp accounts that I have? In this case, its the account that I've been always using and its not under ftp account in my plesk cp. I just really need to change the password to it n I can't find it. Im on Plesk Windows OS
View Replies!
View Related
How To Change An Email Password From SSH
I was using Direct Admin Panel, now expired! How can we change an email password from - 'root' user? I know we can change main domain email password by 'passwd user'. But how to change other emails with that domain? They are surely located in /etc/vitual/domain/password , but in hashed format. How to change via command line?
View Replies!
View Related
How Would A Hacker Change A Cpanel Password
I'm having a problem with a hacker...using insecure scripts on my user's accounts he changes Cpanel passwords. I do not understand how a script running as user nobody would change a Cpanel password. Any ideas on that ? I am using mod security (rules from gotroot.com), register_globals are disabled. I also disabled the password reset feature as I thought the hacker may be resetting the passwords and then reading the new password from the email account on the server using the insecure script. Unfortunately this guy simply doesn't stop...he seems to have a reverse DNS list or something. He is only attacking accounts on one specific server of mine but I am pretty sure he doesn't have root access.
View Replies!
View Related
How To Change Email Password From Ssh
I am just a newbie with linux and ssh.I know that we can control the server with ssh. SSH is faster and more secure than Web control.I need your help about with ssh:How to change the email password?How to add email address?How to disable/remove email address?How to forward email?Pleaser help me with one or more question above.My Server installed with Centos 4.4 with Cpanel 10.Thank you so much in advance.Longpt
View Replies!
View Related
Change Databases Password Wihout Effecting Users
my server has just compromised and someone can retrieve all databases on server with my root sql password. i changed the root sql password to avoid attacking again and want to ask a question...do i have to change all user's databases password too? many users have wordpress, forum and other php scripts with config file contains current database password.If i change their pass their sites will stop working. How to do this without bothering users?
View Replies!
View Related
DirectAdmin - Access Denied For User 'apache'@'localhost' (using Password: NO)
I get the following error when let my site connect to my database: Access denied for user 'apache'@'localhost' (using password: NO) But when im running lil test script which connect to my localhost with the same passwords and it gives the status 'Connection OK' (im running on admin account, made a MySQL account with DA) Code: <?php $link = mysql_connect('localhost','admin_removed','removed'); if (!$link) { die('Could not connect to MySQL: ' . mysql_error()); } echo 'Connection OK'; mysql_close($link); ?>
View Replies!
View Related
ERROR 1045 (28000): Access Denied For User 'root'@'localhost' (using Password: NO)
Im trying to setup a mysql server on my centos vps server. Ive installed mysql server and done chkconfig and the mysql server has started. My problems start when i want to set a mysql root password. Quote: mysqladmin -u root password yourrootsqlpassword mysqladmin -h server1.example.com -u root password yourrootsqlpassword I get an error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)" Which i totally dont understand because why would it want a password when im trying to set the password?
View Replies!
View Related
Why Should Us Change The User/group Of Apache
APache is running under the "nobody" user/group as default in CPanel servers as a suggestion I should change it to another user/group to improve security! But in CPanel servers its hard to do that because you must edit some scripts and files to prevent the backing to nobody when running some scripts such PHP Code: /scripts/chownpublichtmls/scripts/enablefileprotect or when create a new account Some sites says "the secret of changing the user/group is in the UID/GID of nobody < 100 !" so I found a solution : 1 - delete the user/goup nobody 2 - recreate it with GID/UID > 30000 3 - run /scripts/chownpublichtmls so the question is that solution improve security or i should change the user/group to another one! like "www"?
View Replies!
View Related
Change Chroot FTP User Path
I'm using Plesk on my server and its a pain in the @** to create FTP users. So I found this article on adding chrooted FTP users. I successfully added a user, but would like to change the path now, how can I do this?
View Replies!
View Related
Get Mysql Database From Shell
I have a problem getting mysql to start, so I am planning to setup a new server and move all the mysql databases to a new server. The problem is I normally get mysql databases when mysql is running by using mysql command lines. Now that I cannot start mysql, I cannot use that method. Is there a mysql directory that contains all the mysql databases for me to tar it up and untar it on a different? If there is a directory that contains all the mysql databases, do I need to exclude some files/folders so it doesnt conflict with the files/folders on my new mysql server?
View Replies!
View Related
MySQL Password
I am transfering my database to a new host and well I need to create the same database (same name and username) along with the same password I used before (because a script im using is connected to it) then import the old .SQL files. However I dont know how I can find out the current password linked to that database (When you create one it asks you for a password remember?) Anyclue how to find it out? I cant change it I need to know what it is still. I am using cPANEL
View Replies!
View Related
Importing Large Mysql DB In Shell
if there was a way for me to cut up a large mysql database in shell. We're talking almost 8 gigs here. I would like to import it in chucks, something like 1 gig per shot. Is that doable with some software that I can use in shell? I wouldn't want to use vim to splice up that sucker. Or is there a better method of doing this? I already dumped this and I rather not do it again unless if I could perhaps dump this in chunks.
View Replies!
View Related
Setting Root Password MySQL
I can't seem to get passed p21 of Database Driven Website by Kevin Yank. But I'm learning Ive got the latest copy and and want to follow it through to see what i can learn (lots I'm sure) Im on a mac osx and am trying to set the root password. He says to do this using terminal in the bin directory of my MySql installation. Where is it? i know basics about getting round terminal i.e changing directories and stuff.
View Replies!
View Related
Fetch Admin Password From MySQL Database
I have forgot the admin password for one of our application. All the users and passwords are stored in database table "users", is there any way I can get the password from the database.. any MySQL query that will fetch the admin password from that database table.
View Replies!
View Related
MySQL Won't Accept Commands: Wrong Password
I am just trying out MySQL on the external Apache server. I must have written down the wrong password. My commands to enter mysql with a password results in denied access. What file do I undo in order to create a new password? I don't know the exact steps I'm supposed to take. I don't think this is a MySQL issue, but a server issue, right? I used to create databases and tables on my regular computer and left off the password altogether while I was practicing. Now I'm taking steps to do it on the actual server, and have run across this problem.
View Replies!
View Related
Change Dir For Mysql
I have a server with /var too small, then i move /var/lib/mysql to another location, i've changed in /etc/my.cnf. Quote: datadir=/home/mysqldir socket=/home/mysqldir/mysql.sock I can start / stop mysql but mysql & eximstats in WHM failed. I've try : Quote: mysql -vv ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
View Replies!
View Related
Change Mysql Language
Where do i change the language of mysql(4.0) i have WHM on a centos 5 box i checked that the current path is /usr/share/mysql/spanish and it must be /usr/share/mysql/english is there any way to do this?
View Replies!
View Related
MySQL Forgetting User Permissions
Does anyone know what could be the cause of this issue? I located a few others over at cpanel.net that have this problem, but no solution has been found. [url] I am running a VPS server with the following: WHM 10.8.0 cPanel 10.9.1-S14304 RedHat 9 i686 - WHM X v3.1.0 phpMyAdmin - 2.9.0.2 MySQL client version: 4.1.10 mysql version: 5.0.27-standard I have a database user that needs "Super Privileges" and so this was done. However, when Cpanel is updated the user permission is reset automatically from "ALL PRIVILEGES" to "USAGE". Here's a look at the database permissions from phpMyAdmin. Code: User Host Password Global privileges Grant hello localhost Yes ALL PRIVILEGES Yes hello_ % No ALL PRIVILEGES Yes hello_ localhost No ALL PRIVILEGES Yes The user "hello" loses its "ALL PRIVILEGES" and switches over to "USAGE" if an update is triggered. Updates to cpanel, creating/removing a database/user, and updating the account password will cause the switch.
View Replies!
View Related
Mysql/user Is Marked As Crashed
I am trying to start mysql but i am getting the following error MySQL manager or server PID file could not be found! [FAILED] Starting MySQL................................... [FAILED] I checked my hostname.err file in /var/lib/mysql and this is the error message it shows. 070130 17:59:41 mysqld started 070130 17:59:42 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 mysqld ended how I would repair that to get mysql to start again?
View Replies!
View Related
What Are Common MySQL User Permissions
I want to use something like PHPBB forums and using one MySQL user and database. Just wondering, what are common user permissions I should set for the user? I want to try to minimize any permissions that can cause big risk to the server security. Here is a full list of permissions I can grant to the user (via Webmin): -Select table data -Insert table data -Update table data -Delete table data -Create tables -Drop tables -Grant privileges -Reference operations -Manage indexes -Alter tables -Create temp tables -Lock tables
View Replies!
View Related
MySQL Replication For User On Shared Server
I never did replication and do not know much about it so I figured I would ask here if anyone knows or has done it before like this. I have a user who wants me to enable replication on my server for his user. I dont like the sounds of it on a shared environment but if there is no risk to other users and its not a big resource hog I will do it. Anyway, from what I gather I have to: 1. execute: GRANT REPLICATION SLAVE ON user_main.* TO 'repl'@'ip-here' IDENTIFIED BY '4T6WjUZa'; [url] 2. Stop mysql server and Add in my.cnf: [mysqld] log-bin=mysql-bin server-id=1 slave-compressed=1 binlog-do-db=user_main start server[url] 3. execute: SHOW MASTER STATUS; we need values of colomns File and Position from output of above command[url] So my questions are: Is there any security risk? Is there significant extra resource usage? Is this even done on shared environments?
View Replies!
View Related
Mysql User Privilege Changed By Cpanel Or What
I am using Cpanel. One Cpanel account is backup. I use it to backup my database. Under mysql, I gave this account ( backup ) many priviledges. But when the backup script ran, error said that backup account can not 'lock table'. I gave "lock table' priviledge again and run the script, it is ok. But after a while, when the script ran autmatically on daily basis, it lost the 'lock table' priviledge again. I wonder if Cpanel is messing me up? What can I do about it? anyone knows?
View Replies!
View Related
MySQL: Access Denied For Root User
When I deleted a database, the user apparently was orphaned because when I tried to recreate it, it returned "user already exists". I've never encountered that problem although from Googling, I see others have and they delete the user to get around it. When I log into mysql using the da_admin@ account and attempt to remove the user with drop user <user_name>; I receive the following error message: ERROR 1227 (42000): Access denied; you need the CREATE USER privilege for this operation It seems I don't have rights even as the root user. How can I get remove the orphaned user?
View Replies!
View Related
|