This program takes a hostname as input and constructs an SSH command to connect to a remote server with a predefined username. This resolves the need to manually create aliases across different hosts. Just pull, compile, and run the binary. If needed, you can easily change or add flags for the "ssh command" in the source code.
- The program accepts one command-line argument: the hostname of the server you want to connect to.
- It constructs an SSH command with a predefined username and the provided hostname.
- The program then executes the SSH command using the
system()
function and displays the command being executed. - If any errors occur during execution, they are printed to the standard error stream.
Make sure to update the username in the source on line 7:
const char *username = "<username>";
To compile the program, use the following command:
gcc -o sshuc sshuc.c
For easy usage move the compiled binary to /usr/bin
$ sudo mv sshuc /usr/bin
Execute
sshuc <hostname>
Replace with the address of the server you wish to connect to.
Example:
sshuc example.com