For many low end hosting solutions you get a virtual machine with a root SSH access. The first thing you need to do is to add new UNIX user (you), add SSH key, check SSH connection works and then disable root SSH login and so on.

Does there exist any well-known helper script or shell one-liner to perform these actions (remotely over root SSH) for the initial server provision? Doing it adduser, set password, create authorized_keys dance by hand every time seems to be a lot of repeative work.

closed as off-topic by Michael Hampton Apr 2 '15 at 23:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    man ssh-copy-id - Though, personally, I use an Ansible playbook for this. – Michael Hampton Apr 2 '15 at 23:34
  • Thanks. I am aware of ssh-copy-id and it is only a part of the solution, unfortunately. – Mikko Ohtamaa Apr 2 '15 at 23:40
  • 1
    The rest of it is maybe three or four simple lines of shell script, all of which you already seem capable of writing, and all of which you already know what is needed. But Server Fault is not a script writing service or a shopping service, so I don't think there's much else we can do with this question. – Michael Hampton Apr 2 '15 at 23:49
  • 1
    @MichaelHampton: Thank you Michael. I am very well-aware what ServerFault is. However, I myself deem this questionworthy as many sysadmins are facing this issue daily and are probably brewing their 3-4 lines of scripts, until they become aware of community solutions like ssh-copy-id. Thus, I see there might be need for more a packaged solution in this field and I would be surprised if one doesn't exist already, but people might not be aware of it (like was the case with ssh-copy-id couple of years ago). I think you have jumped to close this question a tad early. – Mikko Ohtamaa Apr 3 '15 at 0:09
  • If you disagree with the post being closed you're welcome to post on Meta Server Fault and solicit other opinions from other community members and moderators. – Michael Hampton Apr 3 '15 at 0:12

Browse other questions tagged or ask your own question.