How to automount a windows share in Linux using smbfs.
This will help your Linux operatingsystem automount a windows share.
Install smbfs:
# sudo aptitude install smbfs
Create a folder where the windows share should be mounted:
# sudo mkdir /media/MediaLibrary
Create a credentials file:
# nano /root/.smbcredentials
Add the username and password for the server:
username=ftornell
password=Password123
Make the file readable for the root only:
# sudo chmod 700 /root/.smbcredentials
Edit fstab (create a backup of the original first):
# nano /etc/fstab
Add the following:
//192.168.0.10/media /media/MediaLibrary cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Reboot or use the command:
# sudo mount -a
2010-09-05
How to fix a recovery database to a clean state using Eseutil
If we were to create a recovery database in Exchange 2010 using a backup, the database might give you a warning saying: The database must be brought into a clean shutdown state before it can be mounted.
How to see the state of the database using Eseutil:
# Eseutil.exe /MH "DB01.edb"
This will most likely display State: Dirty Shutdown
To fix this using Eseutil from the log folder:
# Eseutil.exe /R E00 /I /d
2010-09-05
How to enable clickable links in OCS2007R2
When running a standard installation of OCS2007R2 we are not allowed to post links in the chat window that the receiving user can click on. Insted the url is starting with an underscore like _http://www.logicspot.net
To disable the underscore and get it clickable:
1. Open up the OCS2007R2 Console
2. Ricght click Forest > Standard Edition Servers > ServerName and choose Filtering Tools > Intelligent Instant Message Filter
3. Uncheck Block all hyperlinks...
4. Change the regkey to value of 1 using GPO on the clients:
HKEY_CURRENT_USER>Software>Policies>Microsoft>Communicator>EnableURL=1
2010-08-07
How to use a shell script to do a tar archive of selected folders in Linux
Like every OS its a good idea to have a backup of files on a separate hard drive or server if the primary fails.
This guide will help you out to create a backup script and have it to run once a day and store it on another disk.
In this guide we have a separate disk called Backup mounted into /media/Backup.
The Shell Script
1. Use any type of editor to create a file called backup.sh and store it in /usr/local/bin
2. Paste in this text
#!/bin/sh
####################################
#
# Backup to NFS mount script.
#
####################################
# What to backup.
backup_files="/home/ftornell/Pictures /home/ftornell/Music /home/ftornell/Documents /var/spool/mail"
# Where to backup to.
dest="/media/Backup/Backup_Archive"
# Create archive filename.
day=$(date +%F)
hostname=$(hostname -s)
archive_file="$hostname-$day.tgz"
# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo
# Backup the files using tar.
tar czf $dest/$archive_file $backup_files
# Print end status message.
echo
echo "Backup finished"
date
# Long listing of files in $dest to check file sizes.
ls -lh $dest
Note:
day=$(date +%F) will save the file into "Hostname-2010-05-22.tgz"
day=$(date +%A) will save the file into "Hostname-saturday.tgz"
Make the file executable:
# chmod +x /usr/local/bin/backup.sh
The cron job
To list the current cronjobs for the user:
# cron -l
To edit the crontab file:
# cron -e
To have the shell script run once a day at 12:00 AM, put this in the file (notice that the first line is already there:
# m h dom mon dow command
0 0 * * * bash /usr/local/bin/backup.sh
Restore from Archive
To list the contents of the archive:
# tar -tzvf /media/Backup/Hostname-2010-05-22.tgz
To restore file(s) from the archive to a temporary folder:
# tar -tzvf /media/Backup/Hostname-2010-05-22.tgz -C /tmp home/ftornell/Documents
2010-07-09
How to use content filter to move messages to the Junk Mail folder!
This will get the SCL threshold up and running!
There are three thresholds in Exchange 2007/2010:
- SCLDeleteThreshold
- SCLRejectThreshold
- SCLQuarantineThreshold
SCLDeleteThreshold
Messages with SCL equal to or higher than the threshold will be deleted silently.
To set SCLDeleteThreshold to 8:
# Set-ContentFilterConfig -SCLDeleteThreshold 8 -SCLDeleteEnabled:$true
SCLRejectThreshold
Messages with SCL equal to or higher then the threshold will be rejected during the SMTP session. The sender will get an NDR.
To set SCLDeleteThreshold to 8:
# Set-ContentFilterConfig -SCLRejectThreshold 7 -SCLRejectEnabled:$true
Messages that dont get accepted will response with: Message rejected due to content restrictions.
To change the response message:
# Set-ContentFilterConfig -RejectionResponse “We dont want your spam!”
SCLQuarantineThreshold
Messages with SCL equal to or higher than the threshold are delivered to the quarantine mailbox that must exist.
To configure SCLQuarantineThreshold and specifi a quarantine mailbox:
# Set-ContentFilterConfig -SCLQuarantineThreshold 6 -SCLQuarantineEnabled:$true -QuarantineMailbox:Quarantine@contoso.com
The Junk Folder
To move the messages to the users Junk Mail folder we need another type of Threshold; SCLJunkThreshold and is a part of the Set-OrganizationConfig cmdlet.
To set CSLJunkthreshold:
# Set-OrganizationConfig -SCLJunkThreshold 5
2010-07-08
How to troubleshoot an Edge Transport server
If you are seeing an error message saying 451 5.7.3 Cannot achieve Exchange Server authentication in the Queue viewer you have to change the permission settings on the Receive Connectors.
To change the permission on an Edge Transport server:
1. Open up Exchange Management Console
2. Go to Receive Connectors
3. Go to the Authentication tab
4. Check the Transport Layer Security (TLS) and the Exchange Server authentication check box.
5. Click Apply
To change the permission on an Edge Transport server that is installed on a TMG:
1. Open up TMG Console
2. Go to E-Mail Policy
3. Go to the E-Mail Policy tab
4. Choose properties on Internal_Mail_Servers
5. Go to Listener tab and press Advanced
6. Check the Transport Layer Security (TLS) and the Exchange Server authentication check box.
7. Uncheck Externally Secured (for example, IPsec)
8. Press OK
2010-07-07
How to renew a self-sign certificate in Exchange 2007/2010
If working in a lab environment there are often no need to buy a certificate from a vendor, instead we can use the self-signed one that were installed during the Exchange installation process.
However this certificate is only valid for a year and if the lab environment is going to live that log one might have to renew the certificate.
To list the certificate:
# Get-ExchangeCertificate | fl
Now the self-signed certificate will appear and we can se the thumpprint, for instance:
7ADD5B60949267AD62A218D8492C4C5281FDD12R and what services that its bound to. IIS, POP, IMAP, SMTP
To renew the certificate:
# Get-ExchangeCertificate -Thumbprint 7ADD5B60949267AD62A218D8492C4C5281FDD12R | New-ExchangeCertificate
Now you must verify if you want do overwrite the old one, press Y or A.
To enable the services again get the new thumbprint:
# Get-ExchangeCertificate | fl
To enable a service:
# Enable-ExchangeCertificate -Thumbprint 5GDD5B60949267AD62A218D8492C4C5281FDD56R -Services IIS
2010-07-06
How to change all the users alias using a csv file
First we need to create a csv file containing two types of data: mail and newalias.
Aliases.csv:
mail,newalias
alex.westwood@contoso.com,awestwood
james.smith@contoso.com,jsmith
This tiny line of code will change all the users aliases, using powershell:
# Import-csv Aliases.csv | foreach {Get-Mailbox -identity $_.mail | Set-Mailbox -Alias $_.newalias}
2010-07-06
How to configure NLB to use forwarding
This little guide will help packages that enters on the Private NIC (NLB) without a default gateway to pass trough to another subnet instead of being dropped.
To see the currnet NICs:
# netsh interface ipv4 show int
To see the current NIC configurations:
# netsh interface ipv4 show interface l=verbose
To change the Forwarding function:
# netsh interface ipv4 set interface "Private NIC Used for NLB" forwarding=enabled
2010-07-06
How to create and configure a Relay Connector in Exchange 2007/2010
Like precious versions, Exchange 2007 and Exchange 2010 allows authenticated relaying by default. That means if your application server or device can authenticate, then go for it.
That means that we dont need additional configuration on the Exchange Hub servers.
If we need to allow unauthenticated relaying we should create a new Receive Connector.
We can create a new Receive Connector on server EX01 (192.168.0.10) called "Relaying Connector" and allow the IP-address 192.168.0.50 to connecto to it.
It also assigns the ExchangeServer permission group and disables authentication, it assumes that we trust the ip-address 192.168.0.50 and have another type of authentication, like IPSec.
Finally it bypasses all security for messages received from that IP-address. It will not apply any anti-spam filters, nor cares about message size limits or sending on behalf of users.
To create a new Receive Connector:
# New-ReceiveConnector -Name "Relaying Connector" -Usage Custom -Bindings 192.168.0.10:25 -fqdn EX01.contoso.com -RemoteIPRanges 192.168.0.50 -Server EX01 -PermissionGroups ExchangeServer -AuthMechanism TLS,ExternalAuthorative
Another more secure way is to create a Receive Connector with PermissionGroups set to AnonymousUsers:
# New-ReceiveConnector -Name "Relaying Connector" -Usage Custom -Bindings 192.168.0.10:25 -fqdn EX01.contoso.com -RemoteIPRanges 192.168.0.50 -Server EX01 -PermissionGroups ExchangeServer
Note: We didnt have the AuthMechanism parameter in the above command.
Next is to allow anonymous users to relay:
# Get-ReceiveConnector "Relaying Connector" | Add-ADPermission -User "NT AUTHORITYANONYMOUS LOGON" -ExtendedRights ms-Exch-SMTP-Accept-Any-Recipient