Rssh

From DreamHost

Jump to: navigation, search

rssh is a restricted shell, used as a login shell, that allows users to perform only ftp, sftp, scp, cvs, rdist, and/or rsync operations. It is implemented on DreamHost to allow the following functionality for the Backups user:

  • rsync
  • scp
  • sftp
  • ftp

rsync only runs on on Unix machines, so Windows users will need a shell with a Windows user-interface to automate Personal Backups:

  • DeltaCopy
  • CWRSYNC Is a packaging of rsync, ssh client and the required cygwin libraries for Windows. It runs on all versions of Windows.

Getting your Backups User diskspace usage

You can get the information through the DreamHost API. Just follow these steps:

1. Create a new API key (here) with access to the function user-list_users_no_pw.
2. Insert your login username (usually an e-mail address) and the API key you just generated into the following script.
3 (optional). Install the uuid PHP module. The script will fall back to PHP's built-in methods if it's not availabe, so this step is completely optional.

<?php

$USERNAME = 'your@login.com';
$API_KEY = 'PUT YOUR API KEY HERE';

////// DON'T EDIT BELOW THIS LINE //////

$uuid = null;
if ( function_exists('uuid_create') )
{
	uuid_create(&$uuid_obj);
	uuid_make($uuid_obj, UUID_MAKE_V4);
	uuid_export($uuid_obj, UUID_FMT_STR, &$uuid);
}
else
	$uuid = sha1(uniqid(mt_rand(), true));

$page = file_get_contents(
	'https://api.dreamhost.com/'.
	'?username='.urlencode($USERNAME).
	'&key='.urlencode($API_KEY).
	'&cmd=user-list_users_no_pw'.
	'&unique_id='.urlencode($uuid).
	'&format=tab'
);

if ( $page === false )
	echo 'Error getting page!';
else
{
	$found = false;
	$lines = explode("\n", $page);
	foreach ( $lines as $line )
	{
		$data = explode("\t", $line);
		if ( $data[2] === 'backup' )
		{
			$found = $data[6];
			break;
		}
	}
	
	if ( $found === false )
		echo 'Could not find backup user!';
	else
		echo "$found MB";
}
Personal tools