torsdag 24 november 2016

transfer files via ftp to r-pi and access an SQL-server






FTP


So today I've made it easier to program and change files on the raspberry pi (r-pi). 

Be aware!
 The only thing someone needs to hack a raspberry pi (with raspbian) is the ip.

ssh ftp is already installed on raspbian and the username and passwords are a set standard.

So the only thing you need to change files on it via ftp (sftp actually), is the ip-adress.



I have changed the password now, but it was tricky. There are a lot of passwords you can change (I have found 3 so far).

First I tried to use the terminal and be like the geeks i know. But that password I changed wasn't the right one.

But if you simply go via the GUI in raspbian you can set the one connected to sftp.

And then I just installed filezilla (client version) on my own computer and felt good about myself.

SQL


I made an MySQL database on our domain, something, hoster. When I wrote a program to access it, it wouldn't work!

_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'xx.xxx.x.xxx' (10060)")

Python program:
 #!/usr/bin/python
import MySQLdb
db = MySQLdb.connect("xx.xxx.x.xxx", "username", "password", "database", port)
cursor = db.cursor()
cursor.execute("SELECT VERSION()")
data = cursor.fetchone()
print "Database version: %s" % data
db.disconnect()


What was wrong? I googled it furiously and everything seemed fine.
When I was going to look at our domain hoster for help, I found out that I need to make an SSH-tunnel before making SQL-commands.

That's probably what I will look at tomorrow.



Inga kommentarer:

Skicka en kommentar