-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,22 @@ Therefore, in order to execute you will need to copy an `id_rsa.pub` public key | |
will then take care to append that public key to the `/home/sysadmin/.ssh/authorized_keys` file so you can login using ssh with the newly | ||
created sysadmin user (assuming you have the private key in your machine). | ||
|
||
## ssh port | ||
|
||
This script will change the default ssh port from 22 to 1222 so in order to log in again you will need to either parametrize the `ssh` command or add a | ||
custom configuration to your `~/.ssh/config` file. | ||
```bash | ||
ssh -p 1222 [email protected] | ||
``` | ||
|
||
``` | ||
# ~/.ssh/config | ||
Host 1.2.3.4 | ||
User sysadmin | ||
IdentityFile ~/.ssh/id_rsa # Or whatever your ssh key is. | ||
Port 1222 | ||
``` | ||
|
||
## How to execute | ||
Copy to the host both the script and the public key for the sysadmin account that will be created then execute the script. | ||
|
||
|
@@ -32,7 +48,7 @@ ssh [email protected] | |
Before closing the root session, check that you are able to login with the new sysadmin account: | ||
|
||
```bash | ||
ssh [email protected] | ||
ssh -p 1222 [email protected] | ||
``` | ||
|
||
If you are able to login with the sysadmin account, close the root session. You can validate that root login is disabled by executing: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters