Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Dev Section Scripting / API
  • Search

Can't unsuspend user via vesta API

Questions regarding the API
Application Programming Interface
Locked
  • Print view
Advanced search
5 posts • Page 1 of 1
darkw1nd
Posts: 24
Joined: Fri Aug 28, 2015 8:08 am

Can't unsuspend user via vesta API

Post by darkw1nd » Mon Sep 14, 2015 4:58 pm

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.

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";
}
?>
But when I use command - v-suspend-user I can suspend user.

What I do wrong?

Thanks in advance!
Top

darkw1nd
Posts: 24
Joined: Fri Aug 28, 2015 8:08 am

Re: Can't unsuspend user via vesta API

Post by darkw1nd » Tue Sep 15, 2015 7:53 am

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

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
Top

Elizine
Posts: 50
Joined: Wed Aug 12, 2015 12:11 pm
Contact:
Contact Elizine
Website

Re: Can't unsuspend user via vesta API

Post by Elizine » Fri Sep 25, 2015 7:27 am

Hi,

Check for the password, it might be too long. Or maybe try logging in with other username if you are logging with admin.
Top

KuJoe
Posts: 8
Joined: Wed Mar 04, 2015 11:51 am

Re: Can't unsuspend user via vesta API

Post by KuJoe » Sun Sep 27, 2015 7:19 am

Ran into this also, ended up being the password length issue.

https://github.com/serghey-rodin/vesta/issues/443
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Can't unsuspend user via vesta API

Post by skurudo » Fri Sep 23, 2016 12:38 pm

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
Top


Locked
  • Print view

5 posts • Page 1 of 1

Return to “Scripting / API”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password