diff --git a/core/ajax/share.php b/core/ajax/share.php
index 806ca9fb98f3df0a58acd02f3d898475fa941851..debdf612c0e54d0affdd34f9881c3245787a7566 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -26,8 +26,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 		case 'share':
 			if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
 				try {
-					OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], (int)$_POST['shareType'], $_POST['shareWith'], $_POST['permissions']);
-					// TODO May need to return private link
+					if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') {
+						$shareWith = null;
+					} else {
+						$shareWith = $_POST['shareWith'];
+					}
+					OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], (int)$_POST['shareType'], $shareWith, $_POST['permissions']);
 					OC_JSON::success();
 				} catch (Exception $exception) {
 					OC_JSON::error(array('data' => array('message' => $exception->getMessage())));
@@ -36,7 +40,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 			break;
 		case 'unshare':
 			if (isset($_POST['shareType']) && isset($_POST['shareWith'])) {
-				$return = OCP\Share::unshare($_POST['itemType'], $_POST['itemSource'], $_POST['shareType'], $_POST['shareWith']);
+				if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') {
+					$shareWith = null;
+				} else {
+					$shareWith = $_POST['shareWith'];
+				}
+				$return = OCP\Share::unshare($_POST['itemType'], $_POST['itemSource'], $_POST['shareType'], $shareWith);
 				($return) ? OC_JSON::success() : OC_JSON::error();
 			}
 			break;
diff --git a/core/css/share.css b/core/css/share.css
index e4b4870dd163a0171f37c837181ae07a46df7c50..a8ffc8df42ef4c0e53d292acb9650dd932f08fa2 100644
--- a/core/css/share.css
+++ b/core/css/share.css
@@ -15,4 +15,4 @@ a.showCruds { display:inline; opacity:.5; }
 a.showCruds:hover { opacity:1; }
 a.unshare { float:right; display:inline; padding:.3em 0 0 .3em !important; opacity:.5; }
 a.unshare:hover { opacity:1; }
-#privateLink { border-top:1px solid #ddd; padding-top:0.5em; }
\ No newline at end of file
+#link { border-top:1px solid #ddd; padding-top:0.5em; }
\ No newline at end of file
diff --git a/core/js/share.js b/core/js/share.js
index 3db69dc69010287b2d13e45dd20fd4e823fc1557..4c164f65b24d6891ad1d020f73552d256385082a 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -1,7 +1,7 @@
 OC.Share={
 	SHARE_TYPE_USER:0,
 	SHARE_TYPE_GROUP:1,
-	SHARE_TYPE_PRIVATE_LINK:3,
+	SHARE_TYPE_LINK:3,
 	SHARE_TYPE_EMAIL:4,
 	PERMISSION_CREATE:4,
 	PERMISSION_READ:1,
@@ -118,7 +118,7 @@ OC.Share={
 			}
 		});
 	},
-	showDropDown:function(itemType, itemSource, appendTo, privateLink, possiblePermissions) {
+	showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions) {
 		var data = OC.Share.loadItem(itemType, itemSource);
 		var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">';
 		if (data.reshare) {
@@ -133,11 +133,14 @@ OC.Share={
 			html += '<input id="shareWith" type="text" placeholder="Share with" style="width:90%;"/>';
 			html += '<ul id="shareWithList">';
 			html += '</ul>';
-			if (privateLink) {
-				html += '<div id="privateLink">';
-				html += '<input type="checkbox" name="privateLinkCheckbox" id="privateLinkCheckbox" value="1" /><label for="privateLinkCheckbox">Share with private link</label>';
+			if (link) {
+				html += '<div id="link">';
+				html += '<input type="checkbox" name="linkCheckbox" id="linkCheckbox" value="1" /><label for="linkCheckbox">Share with link</label>';
+				// TODO Change to lock/unlock icon?
+				html += '<a href="#" id="showPassword" style="display:none;"><img class="svg" alt="Password protect" src="'+OC.imagePath('core', 'actions/triangle-n')+'"/></a>';
 				html += '<br />';
-				html += '<input id="privateLinkText" style="display:none; width:90%;" readonly="readonly" />';
+				html += '<input id="linkText" style="display:none; width:90%;" readonly="readonly" />';
+				html += '<input id="linkPassText" type="password" placeholder="Password" style="display:none; width:90%;" />';
 				html += '</div>';
 			}
 			html += '</div>';
@@ -146,8 +149,8 @@ OC.Share={
 			OC.Share.itemShares = [];
 			if (data.shares) {
 				$.each(data.shares, function(index, share) {
-					if (share.share_type == OC.Share.SHARE_TYPE_PRIVATE_LINK) {
-						OC.Share.showPrivateLink(item, share.share_with);
+					if (share.share_type == OC.Share.SHARE_TYPE_LINK) {
+						OC.Share.showLink(itemSource, share.share_with);
 					} else {
 						OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions);
 					}
@@ -264,36 +267,22 @@ OC.Share={
 		$(html).appendTo('#shareWithList');
 
 	},
-	showPrivateLink:function(item, token) {
-		$('#privateLinkCheckbox').attr('checked', true);
-		var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&token='+token;
-		if (token.indexOf('&path=') == -1) {
-			link += '&file=' + encodeURIComponent(item).replace(/%2F/g, '/');
+	showLink:function(itemSource, password) {
+		$('#linkCheckbox').attr('checked', true);
+		var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file');
+		if ($('#dir').val() == '/') {
+			var file = $('#dir').val() + filename;
 		} else {
-			// Disable checkbox if inside a shared parent folder
-			$('#privateLinkCheckbox').attr('disabled', 'true');
+			var file = $('#dir').val() + '/' + filename;
 		}
-		$('#privateLinkText').val(link);
-		$('#privateLinkText').show('blind', function() {
-			$('#privateLinkText').after('<br id="emailBreak" />');
-			$('#email').show();
-			$('#emailButton').show();
-		});
-	},
-	hidePrivateLink:function() {
-		$('#privateLinkText').hide('blind');
-		$('#emailBreak').remove();
-		$('#email').hide();
-		$('#emailButton').hide();
+		file = '/'+OC.currentUser+'/files'+file;
+		var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&file='+file;
+		$('#linkText').val(link);
+		$('#linkText').show('blind');
+		$('#showPassword').show();
 	},
-	emailPrivateLink:function() {
-		var link = $('#privateLinkText').val();
-		var file = link.substr(link.lastIndexOf('/') + 1).replace(/%20/g, ' ');
-		$.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: $('#email').val(), link: link, file: file } );
-		$('#email').css('font-weight', 'bold');
-		$('#email').animate({ fontWeight: 'normal' }, 2000, function() {
-			$(this).val('');
-		}).val('Email sent');
+	hideLink:function() {
+		$('#linkText').hide('blind');
 	},
 	dirname:function(path) {
 		return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
@@ -308,21 +297,21 @@ $(document).ready(function() {
 			var itemType = $(this).data('item-type');
 			var itemSource = $(this).data('item');
 			var appendTo = $(this).parent().parent();
-			var privateLink = false;
+			var link = false;
 			var possiblePermissions = $(this).data('possible-permissions');
-			if ($(this).data('private-link') !== undefined && $(this).data('private-link') == true) {
-				privateLink = true;
+			if ($(this).data('link') !== undefined && $(this).data('link') == true) {
+				link = true;
 			}
 			if (OC.Share.droppedDown) {
 				if (itemSource != $('#dropdown').data('item')) {
 					OC.Share.hideDropDown(function () {
-						OC.Share.showDropDown(itemType, itemSource, appendTo, privateLink, possiblePermissions);
+						OC.Share.showDropDown(itemType, itemSource, appendTo, link, possiblePermissions);
 					});
 				} else {
 					OC.Share.hideDropDown();
 				}
 			} else {
-				OC.Share.showDropDown(itemType, itemSource, appendTo, privateLink, possiblePermissions);
+				OC.Share.showDropDown(itemType, itemSource, appendTo, link, possiblePermissions);
 			}
 		}
 	});
@@ -396,35 +385,43 @@ $(document).ready(function() {
 		OC.Share.setPermissions($('#dropdown').data('item-type'), $('#dropdown').data('item-source'), $(li).data('share-type'), $(li).data('share-with'), permissions);
 	});
 
-	$('#privateLinkCheckbox').live('change', function() {
+	$('#linkCheckbox').live('change', function() {
 		var itemType = $('#dropdown').data('item-type');
-		var item = $('#dropdown').data('item');
+		var itemSource = $('#dropdown').data('item-source');
 		if (this.checked) {
-			// Create a private link
-			OC.Share.share(itemType, item, OC.Share.SHARE_TYPE_PRIVATE_LINK, 0, 0, function(token) {
-				OC.Share.showPrivateLink(item, 'foo');
-				// Change icon
-				OC.Share.icons[item] = OC.imagePath('core', 'actions/public');
+			// Create a link
+			OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.Share.PERMISSION_READ, function() {
+				OC.Share.showLink(itemSource);
+				// TODO Change icon
 			});
 		} else {
 			// Delete private link
-			OC.Share.unshare(item, 'public', function() {
-				OC.Share.hidePrivateLink();
-				// Change icon
-				if (OC.Share.itemUsers || OC.Share.itemGroups) {
-					OC.Share.icons[item] = OC.imagePath('core', 'actions/shared');
-				} else {
-					OC.Share.icons[item] = OC.imagePath('core', 'actions/share');
-				}
+			OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', function() {
+				OC.Share.hideLink();
 			});
 		}
 	});
 
-	$('#privateLinkText').live('click', function() {
+	$('#linkText').live('click', function() {
 		$(this).focus();
 		$(this).select();
 	});
 
+	$('#showPassword').live('click', function() {
+		$('#linkText').after('<br />');
+		$('#linkPassText').toggle('blind');
+	});
+
+	$('#linkPassText').live('keyup', function(event) {
+		if (event.keyCode == 13) {
+			var itemType = $('#dropdown').data('item-type');
+			var itemSource = $('#dropdown').data('item-source');
+			// TODO Do this internally
+			OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '');
+			OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.Share.PERMISSION_READ);
+		}
+	});
+
 	$('#emailPrivateLink').live('submit', function() {
 		OC.Share.emailPrivateLink();
 	});