- Start up the SSHD server on the IBM i using the STRTCPSVR SERVER(*SSHD) command.
- Run a STRQSH on the IBM i.
- Create a HOME directory on the IBM i to store the user's SSH-related objects. mkdir /home/someuser.
- Change ownership of the home directory to the SSH user. chown someuser /home/someuser.
- Set permissions on the user's home directory. chmod 755 /home/someuser.
- Create a .SSH directory within the user's home directory. mkdir /home/someuser/.ssh.
- Change ownership of the .SSH directory to the SSH user. chown someuser /home/someuser/.ssh.
- Set permissions on the user's .SSH directory. chmod 700 /home/someuser/.ssh.
- Then create a pair of RSA keys (private key in PKCS#1 format) via the shell command (from a work directory):
ssh-keygen -t rsa -N ""
Note: the utility will ask you for the file name and you will create a myName file which will contain the private key and a myName.pub file which will contain the public key. - Move the public key (myName.pub) to the /home/someuser/.ssh directory.
- Rename the myName.pub file in authorized_keysmv /home/someuser/.ssh/myName.pub /home/someuser/.ssh/authorized_keys.
- Change ownership of the authorized_keys file to the SSH user. chown someuser /home/someuser/.ssh/authorized_keys.
- Set permissions on the authorized_keys file. chmod 600 /home/someuser/.ssh/authorized_keys.
- Exit Shell mode to return to an IBM i command line.
- Change the home directory parameter in the SSH user's profile to point to the IFS path of the home directory created in Step 2a.
CHGUSRPRF USRPRF(someuser) HOMEDIR('/home/someuser') - Using FTP, transfer the MyName private key to your PC in the build directory (under the "build" directory) of your Gradle project and give it the "sshrsakey" name.
- Delete the myName file (the private key) of the IBM i