My ISP won't let me open some ports on my router so I can't use SSH to connect to my server.
I created this bot to run shell commands on my server remotely through Discord.
I can also use it to run commands on my local machine.
~Modern problems require modern solutions
- Clone the repo
git clone https://github.com/igorkowalczyk/discord-ssh.git
- Install dependencies
pnpm install
ornpm install
- Create
.env
file in the root directory - Copy the content from
.env
config - Fill the
.env
file with your data - Run the bot
pnpm run start
ornpm run start
(orpnpm run dev
ornpm run dev
for development) - Invite the bot to your server (see Discord Developer Portal)
- Send command in channel which you set in
.env
file - Wait for the response, that's it!
Important
You have to enable Message Content
intent in your Discord Developer Portal to use this bot!
Note
Bot will not respond to messages in other channels or other members than you (bot owner) unless you change it in the .env
file or in the code
sudo
/su
commands are not supported, and probably never will be (for security reasons).- Text inputs are not supported (e.g.
nano
), but you can useecho
to create/edit files. - Colored output is not supported and can be broken!
Note
Changing directory (cd
) is supported when it's at the beginning of a command!
# Copy this file to .env and fill in the values.
CHANNEL_ID="Discord channel ID"
OWNERS_IDS="ID 1,ID 2,ID 3"
TOKEN="Discord bot token"
CUSTOM_CWD="Default path to the bot's working directory (optional - remove this line if you don't need it)"
Variable | Description | Required |
---|---|---|
CHANNEL_ID |
Channel ID where bot will listen for commands | β
Yes |
OWNERS_IDS |
Users IDs who can use the bot (separated by , ) |
β
Yes |
TOKEN |
Discord bot token | β
Yes |
CUSTOM_CWD |
Default directory for SSH commands (Default: / ) |
β No |
Note
You can get your Discord user ID/Cannel ID by enabling Developer Mode
in Discord settings and right-clicking on your profile or channel
If you have any issues with the page please create new issue here
When submitting a pull request:
- Clone the repo.
- Create a branch off of master and give it a meaningful name (e.g. my-awesome-new-feature).
- Open a pull request on GitHub and describe the feature or fix.
This project is licensed under the MIT. See the LICENSE file for details