diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php
index 0e83660f845e6401dd966c60c35d1a88f2f29424..f98d000b98932fd8d23780e467d25179edef2ea4 100644
--- a/apps/files_external/appinfo/app.php
+++ b/apps/files_external/appinfo/app.php
@@ -1,6 +1,7 @@
 <?php
 /**
  * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * Copyright (c) 2014 Robin McCorkell <rmccorkell@karoshi.org.uk>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
  * See the COPYING-README file.
@@ -13,6 +14,7 @@ OC::$CLASSPATH['OC\Files\Storage\OwnCloud'] = 'files_external/lib/owncloud.php';
 OC::$CLASSPATH['OC\Files\Storage\Google'] = 'files_external/lib/google.php';
 OC::$CLASSPATH['OC\Files\Storage\Swift'] = 'files_external/lib/swift.php';
 OC::$CLASSPATH['OC\Files\Storage\SMB'] = 'files_external/lib/smb.php';
+OC::$CLASSPATH['OC\Files\Storage\SMB_Auto'] = 'files_external/lib/smb_auto.php';
 OC::$CLASSPATH['OC\Files\Storage\AmazonS3'] = 'files_external/lib/amazons3.php';
 OC::$CLASSPATH['OC\Files\Storage\Dropbox'] = 'files_external/lib/dropbox.php';
 OC::$CLASSPATH['OC\Files\Storage\SFTP'] = 'files_external/lib/sftp.php';
@@ -27,4 +29,5 @@ if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == '
 // connecting hooks
 OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook');
 OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\iRODS', 'login');
+OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\SMB_Auto', 'login');
 
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index f7caafb74aaf5c54b0d80e19b9f53703dfa2bc4e..3512071aeb89e82914ddc76894ba861f94e83d26 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -5,6 +5,7 @@
 * @author Michael Gapczynski
 * @copyright 2012 Michael Gapczynski mtgap@owncloud.com
 * @copyright 2014 Vincent Petry <pvince81@owncloud.com>
+* @copyright 2014 Robin McCorkell <rmccorkell@karoshi.org.uk>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -122,11 +123,18 @@ class OC_Mount_Config {
 						'password' => '*Password',
 						'share' => 'Share',
 						'root' => '&Root'));
+				$backends['\OC\Files\Storage\SMB_Auto'] = array(
+					'backend' => 'SMB / CIFS Auto',
+					'configuration' => array(
+						'host' => 'URL',
+						'username_as_share' => '!Username as share',
+						'share' => '&Share',
+						'root' => '&Root'));
 			}
 		}
 
 		if(OC_Mount_Config::checkcurl()){
-		   	$backends['\OC\Files\Storage\DAV']=array(
+			$backends['\OC\Files\Storage\DAV']=array(
 				'backend' => 'WebDAV',
 				'configuration' => array(
 					'host' => 'URL',
@@ -134,7 +142,7 @@ class OC_Mount_Config {
 					'password' => '*Password',
 					'root' => '&Root',
 					'secure' => '!Secure https://'));
-		   	$backends['\OC\Files\Storage\OwnCloud']=array(
+			$backends['\OC\Files\Storage\OwnCloud']=array(
 				'backend' => 'ownCloud',
 				'configuration' => array(
 					'host' => 'URL',
@@ -185,7 +193,7 @@ class OC_Mount_Config {
 	 * @return array of mount point string as key, mountpoint config as value
 	 */
 	public static function getAbsoluteMountPoints($user) {
-		$mountPoints = array();	
+		$mountPoints = array();
 
 		$datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
 		$mount_file = \OC_Config::getValue("mount_file", $datadir . "/mount.json");
diff --git a/apps/files_external/lib/smb_auto.php b/apps/files_external/lib/smb_auto.php
new file mode 100644
index 0000000000000000000000000000000000000000..52fceea64f45f2537c9f950177256bc24a66f51d
--- /dev/null
+++ b/apps/files_external/lib/smb_auto.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin McCorkell <rmccorkell@karoshi.org.uk>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
+
+class SMB_Auto extends \OC\Files\Storage\SMB{
+	public function __construct($params) {
+		if (isset($params['host']) && \OC::$session->exists('smb-credentials')) {
+			$host=$params['host'];
+			$username_as_share = ($params['username_as_share'] === 'true');
+
+			$params_auth = \OC::$session->get('smb-credentials');
+			$user = \OC_User::getDisplayName($params_auth['uid']);
+			$password = $params_auth['password'];
+
+			$root=isset($params['root'])?$params['root']:'/';
+			$share = '';
+
+			if ($username_as_share) {
+				$share = '/'.$user;
+			} elseif (isset($params['share'])) {
+				$share = $params['share'];
+			} else {
+				throw new \Exception();
+			}
+			parent::__construct(array(
+				"user" => $user,
+				"password" => $password,
+				"host" => $host,
+				"share" => $share,
+				"root" => $root
+			));
+		} else {
+			throw new \Exception();
+		}
+	}
+
+	public static function login( $params ) {
+		\OC::$session->set('smb-credentials', $params);
+	}
+}