This is a simple setup guide to enabling Two Factor Authentication (2FA) on Linux SSH login. I this article I wont go deep into setup and issues that I have faced when implementing this. First thing is first Update your system first. I have used Ubuntu 20.04 and it is always up to date. To enable 2FA you need to install google authenticator modules sudo apt install libpam-google-authenticator Configuration for PAM and SSHD Add the the following line to /etc/pam.d/sshd and After adding this line please restart the sshd services. auth required pam_google_authenticator.so Go to /etc/ssh/sshd_config and check if the following line exist. Default value will be "no" so change it to "yes" to activate. ChallengeResponseAuthentication yes Configuration for Authenticator In the terminal run google authenticator command It will ask few things to acknowledge by user. Details you can see from the below video. Once this part is done you are ready to use the 2FA in ubuntu. T...
Its been a while i was searching for a cheap wifi module and with the help of smart-prototyping.com, i was able to get a module almost less than USD 5.
To connect the module to breadboard for prototyping, i made a small jig to interconnect with the board easily. So i can wire up the device and interface anything to GPIO's.
Be careful with the module cause the device it powered with 3.3V and both UART side levels will be 3.3V so i recommend to use a FTDI converter with 3.3V level select.(one i used can select 3.3 and 5 volts) if you connect 5V the module will fry up. If you have 5V or 12V supply to power up the module i suggest to use LD1117V33 to make 3.3V.
The stock Firmware in the ESP8266 supports AT commands and for communicating with this need an micro-controller like Arduino. But i want to make a simple solution for that without using external micro-controller. NodeMCU firmware was the best thing i found. To upload the NodeMCU firmware please do a google search, there are tons of video's and supporting documents out there. I am not going to explain the flashing in this post.
NodeMCU is Lua based firmware and i hope most of the people will know it. Most router GUI also built by Lua.
If you are done with the flashing the ESP8266 module, lets connect the DS18B20 to GPIO 0. If you are not aware of pin mapping please check it before connecting anything to the module.
Before writing any code, goto thingspeak.com and make an account and get the API key which will be used with the Lua code.
The Library and sample code
You can download the files from the following Github link. DOWNLOADS
I will post only the code which push the data to thingspeak.
*********************************START***********************************
require('ds18b20')
port = 80
gpio0 = 3
ds18b20.setup(gpio0)
function sendData()
t1=ds18b20.read()
t1=ds18b20.read()
print("Temp:"..t1.." C\n")
-- conection to thingspeak.com
print("Sending data to thingspeak.com")
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,'184.106.153.149')
conn:send("GET /update?key=YOURAPIKEY&field1="..t1.." HTTP/1.1\r\n")
conn:send("Host: api.thingspeak.com\r\n")
conn:send("Accept: */*\r\n")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
conn:send("\r\n")
conn:on("sent",function(conn)
print("Closing connection")
conn:close()
end)
conn:on("disconnection", function(conn)
print("Got disconnection...")
end)
end
tmr.alarm(0, 60000, 1, function() sendData() end )
I wish this would help you to do your own projects.
To connect the module to breadboard for prototyping, i made a small jig to interconnect with the board easily. So i can wire up the device and interface anything to GPIO's.
Be careful with the module cause the device it powered with 3.3V and both UART side levels will be 3.3V so i recommend to use a FTDI converter with 3.3V level select.(one i used can select 3.3 and 5 volts) if you connect 5V the module will fry up. If you have 5V or 12V supply to power up the module i suggest to use LD1117V33 to make 3.3V.
The stock Firmware in the ESP8266 supports AT commands and for communicating with this need an micro-controller like Arduino. But i want to make a simple solution for that without using external micro-controller. NodeMCU firmware was the best thing i found. To upload the NodeMCU firmware please do a google search, there are tons of video's and supporting documents out there. I am not going to explain the flashing in this post.
NodeMCU is Lua based firmware and i hope most of the people will know it. Most router GUI also built by Lua.
If you are done with the flashing the ESP8266 module, lets connect the DS18B20 to GPIO 0. If you are not aware of pin mapping please check it before connecting anything to the module.
Before writing any code, goto thingspeak.com and make an account and get the API key which will be used with the Lua code.
The Library and sample code
You can download the files from the following Github link. DOWNLOADS
I will post only the code which push the data to thingspeak.
*********************************START***********************************
require('ds18b20')
port = 80
gpio0 = 3
ds18b20.setup(gpio0)
function sendData()
t1=ds18b20.read()
t1=ds18b20.read()
print("Temp:"..t1.." C\n")
-- conection to thingspeak.com
print("Sending data to thingspeak.com")
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,'184.106.153.149')
conn:send("GET /update?key=YOURAPIKEY&field1="..t1.." HTTP/1.1\r\n")
conn:send("Host: api.thingspeak.com\r\n")
conn:send("Accept: */*\r\n")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
conn:send("\r\n")
conn:on("sent",function(conn)
print("Closing connection")
conn:close()
end)
conn:on("disconnection", function(conn)
print("Got disconnection...")
end)
end
tmr.alarm(0, 60000, 1, function() sendData() end )
***********************************END*************************************
Here is the out put to the thingspeak. You can do much more other than a chart. You can add google gauges easily and monitor a relay or button status.
I wish this would help you to do your own projects.
Comments