April 2

Linux: ZFS pool migration

On the source system export the ZFS pool(s)
zpool export datapoolname

Remove the drives from the source system and attach them to the target system.After a few minutes type:
zpool import
pool: datapoolname
id: 15530172945248346540
state: ONLINE

Find  the data pool ID and type the following:
zpool import 15530172945248346540

Verify by typing the following:
zpool status

Category: Linux | Comments Off on Linux: ZFS pool migration
April 2

Linux: Samba setup example

apt-get install samba swat #swat is a great tool for easy configuration.

Create user:
adduser smbuser

Create Samba Password
smbpasswd -a smbuser

Example configuration file:
/etc/smb.conf

[data]
path = /mnt/yourfolder
comment = Share Folder
username = smbuser
valid users = smbuser
admin users = smbuser
unix extensions = No
read only = No
create mask = 0777
directory mask = 0777

Restart smbd
service smbd restart

By: nighthawk

Category: Linux | Comments Off on Linux: Samba setup example
March 19

Linux: Send gmail from the command line

Install msmtp

The first step is to install the msmtp-mta package.
sudo apt-get install msmtp-mta

After the install is complete you’ll need to set up the defaults file with your Gmail account information. You need to create a file in your home directory called .msmtprc.
nano ~/.msmtprc

Paste the following into the file and edit the portions in bold to reflect your account information.

#Gmail account
defaults
logfile ~/msmtp.log

account gmail
auth on
host smtp.gmail.com
from [email protected]
auth on
tls on
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
user [email protected]
password your_gmail_password
port 587

account default : gmail

Save the file and exit the text editor. Since this file contains your account credentials, you’ll want to change the permissions to make the file readable only by you.
chmod 600 .msmtprc
Install mailx

Now that your computer is configured to talk to Gmail, you need a command line email program to handle writing your email. For this I’m going to use mailx from the heirloom-mailx package.
sudo apt-get install heirloom-mailx

Now you need to set up the defaults file so that mailx uses msmtp to send out the email. This file is called .mailrc.
nano ~/.mailrc

Now paste the following into the file and save it.
set sendmail=”/usr/bin/msmtp”
set message-sendmail-extra-arguments=”-a gmail”

You should now be able to send email from your terminal command line.
Sending email from the command line

Now you can send email from the command line like this:
mail -s “Subject” [email protected]

The cursor will go to a blank line. Enter your email message. When you’re done, hit <Enter> to go to a blank line and then hit <Ctrl>+D to end your message. You have just sent your email.

You can also use a message saved in a text file rather than entering it interactively. This is especially useful if you’re automating this process in a script. In this example, the email is saved in a file called message.txt.
mail -s “Subject” [email protected] < message.txt

By: Linerd and txtweaks

Category: Linux | Comments Off on Linux: Send gmail from the command line
March 18

Linux: Converting virtual machine types – VDI to VMDK

Virtual box has a powerful utility called vboxmanage that can be used to perform virtual machine “type” conversions.
Conversion types: VDI|VMDK|VHD|RAW

vboxmanage clonehd <file.vdi> <file.vmdk> –format VMDK

Category: Linux | Comments Off on Linux: Converting virtual machine types – VDI to VMDK
March 11

Linux: Adding a prefix or space to each line of a file

Using sed you can easily add a prefix for each line of a file.
This is a quick command line way to format your text

sed -i -e ‘s/^/prefix/’ filename.txt

The following will add a space infront of each line
sed -i -e ‘s/^/ /’ filename.txt

Category: Linux | Comments Off on Linux: Adding a prefix or space to each line of a file