Posts Tagged ‘linux’

Install ADB & Fastboot on Ubuntu 18.04 / Linux Mint 19

Posted: 16 Φεβρουαρίου 2022 in Android, linux
Ετικέτες: ,

How to Install ADB & Fastboot on Ubuntu 18.04 / Linux Mint 19?. Android Debug Bridge (ADB) is a versatile command-line tool that enables you to communicate with a device from a client machine. With adb command, you can perform a variety of device actions, such as the installation of Applications, copying files, run shell commands, debug applications e.t.c.

ADB also provides access to a Unix shell for running commands on the device. ADB works in a client-server model and it includes three components:

  • adbd: This is a daemon running in the background and allows the running of commands.
  • A server: This is a background process running on your development machine to manage communication between the client and the daemon.
  • A client: The client is responsible for sending commands from you local machine to a device over USB connection.

Install ADB & Fastboot on Ubuntu 18.04 / Linux Mint 19

ADB comes included with Google’s Android SDK but the package can be installed independently on Ubuntu 18.04 / Linux Mint 19. Install both ADB & Fastboot by running the commands below.

sudo apt update
sudo apt-get install android-tools-adb android-tools-fastboot

Get ADB version details.

$ adb version
Android Debug Bridge version 1.0.36
Revision 1:7.0.0+r33-2

If you try list for connected devices, ADB server should be started if not already running.

$ adb devices
List of devices attached
daemon not running. starting it now on port 5037 *
daemon started successfully *

The Service can also be started by running:

sudo adb start-server 

How to Enable adb debugging on your device

You must enable USB debugging on your device to use adb over USB. Navigate to system settings, and enable it under Developer options.

To reset your adb host, run:

adb kill-server

Check help page with --help option.

install adb ubuntu linux mint

Check Google ADB documentation for more details.

Another option you can employ is xkill. This is preinstalled in Ubuntu, but you can install it via the Terminal (which you can open with CTRL + ALT + T) if necessary. When called, xkill will enable you to close any desktop app. Install it with the following command:

sudo apt-get install xorg-xkill

Once this is done, run xkill by simply typing

xkill

Your mouse pointer will then display a cross (or a skull), and all you need to do is left-click on the offending application.

If it’s not possible to close your unresponsive app with any of these desktop-focused methods, the solution might be the command line…

1) Download a driver for linux from Samsung. Samsung M2070 Linux Printer/Scanner Driver (15.87 MB) is at http://www.samsungdrivers.net/samsung-m2070-driver/

2) Unzip your downloaded file.

3) Make sure about the location of the directory which contains a file named » install.sh «. It must be in downloads/XXXX(You named!!)/ uld.

I repeat. » install.sh » is in ULD.

4) Open TERMINAL to go to the directory which has » install.sh » in it.

cd downloads

cd XXXX

cd uld

5) Install a driver by command.

sudo ./install.sh

Note that you have to hit «Enter» many many times to reach the line which asks you to choose y/n. Go slow. Otherwise you’ll have to go back to the directory of ULD and command again.

Send Email when IP Address Changes

Posted: 6 Μαρτίου 2018 in linux
Ετικέτες: , , , ,

Εγκατάσταση msmtp σε  GNU/Linux για να στέλνουμε  emails από το  gmail

Βήμα 1: Κάνουμε εγκατάσταση μέσω τερματικού τα απαραίτητα πακέτα.

sudo apt-get install msmtp msmtp-mta

Βήμα 2: Δημιουργούμε ένα app password στο  Google λογαριασμό μας για το  msmtp

This (Step 2.* in this tutorial) was the missing piece of the puzzle which weren’t in any of the msmtp tutorials I did through. I found out about it in one of the Postfix tutorials where it was included after many hours of trial and error. Because at first, I thought the msmtp config file where was password field had to be filled with the same password with what you log in as a person to your account.

Go to: https://myaccount.google.com and log into the email account you want to start sending the emails.

Step 2.1: Select Security from the side menu and turn 2-Step Verification ON.

Step 2.2: After that click on App passwords

Step 2.3: Next up select Other (Custom name)

Step 2.4: Fill in the name as msmtp for example

Step 2.5: Get the password for your msmtp configuration file

Save this password to some notepad temporarily so you can copy & paste it later to a configuration file because once you click DONE you cannot see the password again. At least I have not found a way to re-open this popup.

Βήμα 3: Μπαίνουμε στο msmtprc

sudo nano /etc/msmtprc

Βήμα 4: Διαμορφώστε το msmtprc αρχείο

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        ~/.msmtp.log
account        gmail
host           smtp.gmail.com
port           587
from           username@gmail.com
user           username
password       password
account default : gmail

To  username@gmail.com θα πρέπει να αλλαχτεί στο  config file με το email σας

To password με  τον κωδικό του app του google

Αλλάζουμε αν θέλουμε και το username

Βήμα 5:  Κάνουμε τεστ το email

echo "Message" | mail -s "Title" youremailaddress@gmail.com

Μετά την εντολή θα πρέπει να έχεις παραλάβει το email όπου έστειλες

Βήμα 6:  Κάνουμε εγκατάσταση το curl εάν δεν το έχουμε 

apt-get install curl

Βήμα 7:  Δημιουργούμε τα αρχεία 

1. Δημιουργούμε τα παρακάτω κενά αρχεία

erxeteip.txt  

newip.txt

oldip.txt

 

2. The Script

#!/bin/bash
 
#Script to report public IP address change
#By: Soultidis D. Christos
 

curl ipinfo.io/ip > /home/username/emailscript/erxeteip.txt


oldip=`cat /home/username/emailscript/oldip.txt`
erxeteip=`cat /home/username/emailscript/erxeteip.txt`

if [[ $erxeteip = $oldip ]]
then

    #echo $oldip > /home/username/emailscript/oldip.txt
    echo "Kamia allagi"

else
    echo $erxeteip > /home/username/emailscript/newip.txt
echo $erxeteip > /home/username/emailscript/oldip.txt


    cat /home/username/emailscript/newip.txt | mailx -s "Dynamic Public IP Address" youremail@gmail.com

fi
 

Αποθήκευσε το script  σαν  ip.sh εκτελέσιμο και βάλτο σε έναν φάκελο μαζί με τα άλλα αρχεία

π.χ.

/home/username/emailscript/

Βήμα 8:  Cron και χρονική διάρκεια εκτέλεσης του script μας 

3. Cron
Πατάμε την παρακάτω εντολή στο τερματικό

 
crontab -e

Προσθέτουμε  αυτό ώστε να μπορεί να τρέχει το  script  ανα 5 λεπτά

*/5 * * * * /home/username/emailscript/ip.sh >/dev/null 2>&1

(Το 5 δηλώνει τα λεπτά , βάζουμε όσο θέλουμε εμείς)

Αποθήκευση

Γράφουμε στο τερματικό :

pgrep cron 

Άμα δεν βλέπουμε αριθμό ο  cron δεν τρέχει. Έτσι πατάμε  sudo /etc/init.d/cron start  για να ξεκινήσει

Τέλος

Debian Linux Install OpenSSH SSHD Server

Posted: 24 Ιανουαρίου 2013 in linux
Ετικέτες: , , ,

by

How do I install OpenSSH sshd server under Debian GNU/Linux operating systems?

You need to use the apt-get or aptitude command to install OpenSSH server under Debian Linux. Open a terminal and type the following command to update package database as root user:
# apt-get update

Task: Install OpenSSH server Under Debian Linux

Type the following command:
# apt-get install openssh-server
Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ssh-askpass rssh molly-guard ufw
The following NEW packages will be installed:
  openssh-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 318 kB of archives.
After this operation, 717 kB of additional disk space will be used.
Get:1 http://mirror.anl.gov/debian/ squeeze/main openssh-server amd64 1:5.5p1-6+squeeze1 [318 kB]
Fetched 318 kB in 3s (89.0 kB/s)
Preconfiguring packages ...
Selecting previously deselected package openssh-server.
(Reading database ... 153448 files and directories currently installed.)
Unpacking openssh-server (from .../openssh-server_1%3a5.5p1-6+squeeze1_amd64.deb) ...
Processing triggers for man-db ...
Setting up openssh-server (1:5.5p1-6+squeeze1) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.

By default openssh will run on the TCP port 22. You can verify the same with the following command:
# netstat -tulpn | grep :22
Sample outputs:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3946/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      3946/sshd

You can connect to the Openssh server, type:
$ ssh user@localhost
$ ssh user@sever-ip-here

How Do I Start / Stop / Restart OpenSSH Server Under Debian Linux?

Type the following commands as root user:
# service ssh stop
# service ssh start
# service ssh restart
# service ssh status

OR
# /etc/init.d/ssh stop
# /etc/init.d/ssh start
# /etc/init.d/ssh restart
# /etc/init.d/ssh status

Sample session:

Fig.01: OpenSSH under Debian LinuxClick to enlarge the image

How Do I Open Port 22 At The Firewall Level?

Edit your firewall script and append the following rule to restrict access to 192.168.1.0/24:

/sbin/iptables -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 22 -j ACCEPT

Save and close the file. OR, you can type the command as follows and save it to your firewall config file:

# /sbin/iptables -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 22 -j ACCEPT
# iptables-save > /path/to/your.firewall.conf

How Do I Configure and Secure OpenSSH Server under Debian Linux?

You need to edit the /etc/ssh/sshd_config file using the text editor such as vi, run:
# vi /etc/ssh/sshd_config
See this article which explains config option to tweak in order to improve OpenSSH server security.

Πηγή : http://www.cyberciti.biz/faq/debian-linux-install-openssh-sshd-server/

Το τερματικό είναι ένα πολύ ισχυρό εργαλείο με το οποίο μπορούμε να κάνουμε τα πάντα.
Έχουμε αναφερθεί σε αυτό αρκετά και έχουμε συγκεντρώσει όλα αυτά που πρέπει να ξέρετε, ώστε να το χρησιμοποιείτε σωστά (Τερματικό: Δες τι μπορείς να κάνεις που ίσως δεν γνώριζες!).
Το ccrypt είναι ενα εργαλείο γραμμής εντολών με το οποιο μπορείται εύκολα και γρήγορα να κρυπτογραφήσετε και να αποκρυπτογραφήσετε αρχεία με μονό δυο πολύ απλές εντολές .

Για να εγκαταστήσετε το ccrypt σε Ubuntu/Mint και παράγωγες διανομές ανοίγετε το τερματικό(μπορείτε να το καλέσετε είτε μέσω dash, αρχίζοντας να γράφετε την λέξη terminal,είτε πατώντας συγχρόνως τα πλήκτρα: Ctrl-Alt-T) και δίνετε την εντολή:

osarena code
1
sudo apt-get install ccrypt

Για να κρυπτογραφήσετε το αρχείο θα πρέπει με την εντολή cd να μετακινηθείτε στο φάκελο που βρίσκετε και να δώσετε την εντολή:

osarena code
1
ccrypt file_name

Όπου file_name βάζετε το όνομα του αρχείου και τέλος θα σας ζητηθεί να βάλετε ένα κωδικό κρυπτογράφησης. Το κρυπτογραφημένο αρχείο θα πρέπει να έχει την κατάληξη .cpt.

Για να αποκρυπτογραφήσετε το αρχείο,χρησιμοποιηστε την παρακάτω εντολή και μετά γράψτε το κωδικό που δώσατε πιο πριν:

osarena code
1
ccrypt -d file_name

 

Αναδημοσιευση απο το osarena

Η κρυπτογράφηση του σκληρού μας δίσκου η έστω των προσωπικών μας αρχείων, χρησιμεύει σε περίπτωση κλοπής του μηχανήματος μας η παραβίασης του, προστατεύοντας αν μη τι άλλο τα προσωπικά μας δεδομενα.
Βέβαια το Ubuntu, κατά τη διαδικασια της εγκατάστασης, δίνει αυτή την επιλογή για κρυπτογράφηση. Αν παρ’ ολ’ αυτά δεν το έχετε επιλέξει, ένας από τους καλούς τροπους που μπορουμε να κρυπτογραφήσουμε τον προσωπικό μας φάκελο είναι με το eCryptfs.
Ένα ισχυρό εργαλείο κρυπτογράφησης για το Linux, τ’ οποίο δημιουργεί κρυπτογραφικά metadata, στο header των written files, επιτρέποντας έτσι την αντιγραφή των κρυπτογραφημένων αρχείων σε άλλα μηχανήματα.
Τα αρχεία αποκρυπτογραφούνται, χρησιμοποιώντας το ανάλογο Linux kernel keyring.

-Πρώτα απ’ όλα πρέπει να εγκαταστήσουμε το ecryptfs-utils, τ’ οποίο αρκεί να το αναζητήσετε στο Κεντρο Λογισμικου:

-Εναλλακτικά μπορουμε να το εγκαταστήσουμε και μέσω τερματικού (μπορειτε να το καλέσετε είτε μέσω dash, αρχίζοντας να γράφετε την λέξη terminal, είτε πατώντας συγχρόνως τα πλήκτρα: Ctrl-Alt-T), δίνοντας τη παρακατω εντολη, πατώντας Enter μετά και δίνοντας τον κωδικό μας, μόλις ζητηθεί:

sudo apt-get install ecryptfs-utils

 

-Για να κρυπτογραφήσετε τον προσωπικό σας φάκελο αρκεί να δώσετε σ’ ένα τερματικό τη παρακατω εντολη:

sudo ecryptfs-migrate-home –u username
Όπου username, θα βάλετε το δικό σας. πχ:

Καλό είναι να δημιουργήσετε πρώτα, ένα αντίγραφο των ΜΗ κρυπτογραφημένων δεδομένων σας, ωστε ν’ αποφύγετε τυχόν απρόοπτα (πχ μια διακοπή ρεύματος, κλπ)

-Δίνοντας λοιπόν τη παραπάνω εντολη, το σύστημα θα ζητησει σύνδεση με τον αντίστοιχο λογαριασμό χρήστη, πριν την όποια επανεκκίνηση, προκειμένου να ολοκληρώσει τη διαδικασια της κρυπτογράφησης.
-Κάνοντας login, θα σας ανοιξει ένα pop-up παραθυράκι. Για να εκκινήσει η διαδικασια, πατήστε το κουμπακι αριστερά: Run this action Νοw (εκτέλεση αυτής της ενέργειας τώρα)

-Κάνοντας αυτή την ενέργεια, θ’ ανοιξει ένα παράθυρο τερματικού που θα σας ζητησει τον κωδικό σας. Δίνοντας τον, θα σας εμφανιστούν οι φάκελοι και αρχεία του προσωπικού σας φακέλου.

>>>Σε περίπτωση που έχετε ξεχάσει τον κωδικό σας, μπορειτε να τον ανακτήσετε με την εντολη:

ecryptfs-unwrap-passphrase


Η διαδικασια είναι αυτή, πολύ σύντομη και ασφαλής, μα κάντε ότι κάνετε με προσοχη και κρατώντας αντίγραφο ΜΗ κρυπτογραφημένο σε εξωτερική πηγή (άλλο δίσκο, dvd, usb στικακι).

>>>Δείτε ακομα και τις παρακατω εφαρμογές και τεχνικές κρυπτογράφησης:

  1. Κρυπτογράφησε αρχεία εύκολα. Ιδανικό για UbuntuOne και Dropbox
  2. Furius Cipher: Κρυπτογραφήστε εύκολα και γρήγορα κείμενα.
  3. True Crypt: Κρυπτογραφήστε αρχεία, φακέλους η ολόκληρα partitions εύκολα! (Linux, Windows, MacOSX).
  4. Δημιουργήστε εύκολα, σε 1 λεπτό έναν φάκελο ασφάλειας προσωπικών δεδομένων.
  5. Δείτε και το Sendoid, όπου δίνει δυνατοτητα αποστολής crypto αρχείων και έτσι θα έχετε διπλό “κλείδωμα”.

 

 

Πηγή:http://osarena.net/hacks-guides/ecryptfs-kriptografisi-prosopikou-fakelou-se-ubuntu-me-mia-entoli.html

Σπάσιμο password αρχείων zip σε περιβάλλον linux

Posted: 13 Δεκεμβρίου 2011 in linux
Ετικέτες:

Χρησιμοποιώντας το linux terminal και το πρόγραμμα FCrackZip

Παράδειγμα για περιβάλλον Ubuntu:

1. τρέχουμε την εντολή –
$ sudo apt-get install fcrackzip

και έτσι γίνεται η εγκατάσταση του προγράμματος,

2. τρέχουμε την εντολή για brute force –
$ fcrackzip -v -b -p aaaaaa -u τοόνοματουαρχείου.zip

3. το πρόγραμμα τρέχει και όταν/αν βγάλει άκρη μας ενημερώνει –
PASSWORD FOUND ! ! ! !: pw == τοpasswordτουαρχείου

Το σπάσιμο μπορεί να γίνει και με dictionary mode. Σε αυτή την περίπτωση όμως θα χρειαστεί να έχετε προετοιμάσει και ένα αρχείο λέξεων, ταξινομημένες σε αλφαβητική σειρά.

Οι εντολές του προγράμματος είναι οι εξής:

-h, –help
Prints the version number and (hopefully) some helpful insights.

-v, –verbose
Each -v makes the program more verbose.

-b, –brute-force
Select brute force mode. This tries all possible combinations of the letters you specify.

-D, –dictionary
Select dictionary mode. In this mode, fcrackzip will read passwords from a file, which must contain one password per line and should be alphabetically sorted (e.g. using (1)).

-c, –charset characterset-specification
Select the characters to use in brute-force cracking. Must be one of

a include all lowercase characters [a-z]
A include all uppercase characters [A-Z]
1 include the digits [0-9]
! include [!:$%&/()=?[]+*~#]
: the following characters upto the end of the specification string are included in the character set. This way you can include any character except binary null (at least under unix). For example, a1:$% selects lowercase characters, digits and the dollar and percent signs.

-p, –init-password string
Set initial (starting) password for brute-force searching to string, or use the file with the name string to supply passwords for dictionary searching.

-l, –length min[-max]
Use an initial password of length min, and check all passwords upto passwords of length max (including). You can omit the max parameter.

-u, –use-unzip
Try to decompress the first file by calling unzip with the guessed password. This weeds out false positives when not enough files have been given.

-m, –method name
Use method number «name» instead of the default cracking method. The switch –help will print a list of available methods. Use –benchmark to see which method does perform best on your machine. The name can also be the number of the method to use.

-2, –modulo r/m
Calculate only r/m of the password. Not yet supported.

-B, –benchmark
Make a small benchmark, the output is nearly meaningless.

-V, –validate
Make some basic checks wether the cracker works.