created linode instance with API call but not able to connect to server

Hi
I have created this server with the help of your API call. I have created this server instance and booted it. It is creating easily but I am not able to log in to this server by terminal ssh command or filezilla or using your LISH console……I am getting this on LISH console

########################## LISH console
   li1304-157 login: root

Last failed login: Fri Jun 29 10:13:39 UTC 2018 from 123.201.54.93 on ssh:notty
There were 2 failed login attempts since the last successful login.
This account is currently not available.

CentOS Linux 7 (Core)
Kernel 3.10.0-862.2.3.el7.x8664 on an x8664

Passwords have been disabled. Use SSH:

ssh://[email protected]
#
whenever I am creating any server by API call I am facing same problem,  Following are my API call details.
##############################API CALL details BODY

this is API call ….I have give Personal Access Token with call …….https://api.linode.com/v4/linode/instances

API Body:

{
"image": "linode/centos7",
"rootpass": "*obscured*", "authorizedkeys": [
"ssh-rsa AAAAvalidpublicsshkey[email protected]" ], "stackscriptid": 10079,
"stackscriptdata": { "ghusername": "linode"
},
"booted": true,
"label": "linode5b3hgghghgh", "group": "Linode-Group", "swapsize": 512,
"type": "g6-standard-1",
"region": "eu-west"
}

#

3 Replies

It looks like the StackScript you deployed has resulting in your being locked out of the server. StackScript 10079 disables the root user and creates a new user based on a github user with the given username - the resulting user will have the same name and keys as the github user given in stackscript_data.gh_username. In this case, you've provided a gh_useranme of "linode", and since you don't have those keys you can't access the server.

To recover from this, you could either delete this Linode Instance and redeploy, or rebuild the Linode Instance into a different configuration.

To Delete and Redeploy

To Delete this Linode through the API, make these calls:

export TOKEN="my-api-token"
export LINODE_ID=(this linode's ID)

curl -H "Authorization: Bearer $TOKEN" -X DELETE \
   https://api.linode.com/v4/linode/instances/$LINODE_ID

You can then use the same API call you used to deploy this Linode to deploy a new one, but this time either don't include a stackscript_id (if you don't want root login disabled) or change the gh_username to the username of your own github user and ssh in as that user (for example, my github username is "dorthu", so I would ssh in as [email protected]<ip-address>.

Rebuild Linode Instance

The above approach will result in you receiving a new IP Address for the new Linode Instance. If the IP Address you have now is important, a rebuild will redeploy the same Instance with a new Image.

To rebuild through the API, make this API call:

export TOKEN="my-api-token"
export LINODE_ID=(this linode's ID)

curl -H "Content-type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -X POST \
    https://api.linode.com/v4/linode/instances/$LINODE_ID/rebuild \
    -d '{"image":"linode/centos7",
         "root_pass":(omitted),
         "authorized_keys":[(omitted)]}'

Once the rebuild finishes, you should be able to log into your Linode as normal.

If you don't want to use the API directly, you can accomplish either of these tasks through the Linode Cloud Manager or the Linode CLI.

Hey Thanks Smith………….its solved now…………..i have omitted "stackscriptid": 10079, "stackscriptdata": {
"gh_username": "linode"
},

from body request and created new instance now I am able to login to this server.

Thanks alot!!! hurray ………I was stuck in it from last 4 days.
Thanks

Glad I could help!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct