Can't unsuspend user via vesta API
Can't unsuspend user via vesta API
Hello every one!
I try unsuspend user via vesta API
I try to use this code, but it's not working, user don't suspend.
But when I use command - v-suspend-user I can suspend user.
What I do wrong?
Thanks in advance!
I try unsuspend user via vesta API
I try to use this code, but it's not working, user don't suspend.
Code: Select all
<?php
// Server credentials
$vst_hostname = 'myserver';
$vst_username = 'admin';
$vst_password = 'mypass';
$vst_returncode = 'yes';
$vst_command = 'v-unsuspend-user';
$username = 'tomm';
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => $username,
);
$postdata = http_build_query($postvars);
// Send POST query via cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $vst_hostname . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
// Check result
if($answer == 0) {
echo "Database has been successfuly created\n";
} else {
echo "Query returned error code: " .$answer. "\n";
}
?>
What I do wrong?
Thanks in advance!
Re: Can't unsuspend user via vesta API
I found my problem.
When you run command v-suspend-user or v-onsuspend-user Vesta crash file /etc/passwd in Ubuntu 14.04 LTS.
When I first run v-suspend-user vesta crash file /etc/passwd and I lost control on my server.
After this I can't execute remotely any commands.
How temporary solution I commented this strings in commands v-suspend-user and v-onsuspend-user
When you run command v-suspend-user or v-onsuspend-user Vesta crash file /etc/passwd in Ubuntu 14.04 LTS.
When I first run v-suspend-user vesta crash file /etc/passwd and I lost control on my server.
After this I can't execute remotely any commands.
How temporary solution I commented this strings in commands v-suspend-user and v-onsuspend-user
Code: Select all
# Suspending ftp accounts
#for ftp in $(grep ^$user_.* /etc/passwd| cut -f 1 -d : ); do
# /usr/sbin/usermod --lock $ftp 2>/dev/null
#done
Re: Can't unsuspend user via vesta API
Hi,
Check for the password, it might be too long. Or maybe try logging in with other username if you are logging with admin.
Check for the password, it might be too long. Or maybe try logging in with other username if you are logging with admin.
Re: Can't unsuspend user via vesta API
Ran into this also, ended up being the password length issue.
https://github.com/serghey-rodin/vesta/issues/443
https://github.com/serghey-rodin/vesta/issues/443
Re: Can't unsuspend user via vesta API
API documentation and examples:
http://vestacp.com/docs/API.pdf
CLI commands list and descriptions:
http://vestacp.com/docs/CLI.txt
-> viewtopic.php?f=18&t=12610
http://vestacp.com/docs/API.pdf
CLI commands list and descriptions:
http://vestacp.com/docs/CLI.txt
-> viewtopic.php?f=18&t=12610