madman77 Posted July 18, 2014 Share Posted July 18, 2014 Hey Dudes, I was thinking, they duck would be a good way to physicly enable or disable the SSH service on my headless ubuntu server when i need access to it. im not much of a scriptor but i was wondering if someone could write a short bash script for me that does the following: 1. Check to see if the ssh service is enabled or disabled 2. If enabled, then disable, if disabled then enable. (Im running ubuntu 14.04 LTS) if i now script my ducky to automaticly log myself in as root and call the bash script, I should be able to access the machine remotley simply by plugging in the duck (inserting once will enable ssh, reinserting again should disable ssh) Seems to me like a pretty full proof idea, can anyone help, or see any holes in this idea? Cheers guys :) Quote Link to comment Share on other sites More sharing options...
Solution madman77 Posted July 18, 2014 Author Solution Share Posted July 18, 2014 Ok, found a script that works... #!/bin/bashif `service ssh status | grep -q running`thenservice ssh stopecho "ssh stopped by user"elseservice ssh startecho "ssh started by user" fi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.