Difference between revisions of "Install SU and VI"

From AwkwardTV
Jump to: navigation, search
(Updating category to include a sort parameter; converting to wikitext; adding <pre> tags around preformatted sections)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
The prerequisites for these are running SSH on your AppleTV, and having access to an Intel Mac using universal binaries (except for su; see the note below).  This assumes you haven't upgraded the SSH version on your AppleTV (which you should: [[Install_SSH]]) and therefore can only connect using SSH v1.
 
The prerequisites for these are running SSH on your AppleTV, and having access to an Intel Mac using universal binaries (except for su; see the note below).  This assumes you haven't upgraded the SSH version on your AppleTV (which you should: [[Install_SSH]]) and therefore can only connect using SSH v1.
  
 +
==Installing su==
  
<H4>Installing su</H4>
+
''Note: you don't need to install su to derive its functionality.  To obtain a root shell, simply type 'sudo bash' or 'sudo -s' and enter the password.  The prompt will change from a dollar sign (bash-2.05b$) to a hash (bash-2.05b#) to indicate the elevated privileges.''
 
 
<I>Note: you don't need to install su to derive its functionality.  To obtain a root shell, simply type 'sudo bash' and enter the password.  The prompt will change from a dollar sign (bash-2.05b$) to a hash (bash-2.05b#) to indicate the elevated privileges.</I>
 
  
 
su allows you to login as root ([http://unixhelp.ed.ac.uk/CGI/man-cgi?su]). Ordinarily, you'd need to know the root password. Try typing the following to see what I mean:
 
su allows you to login as root ([http://unixhelp.ed.ac.uk/CGI/man-cgi?su]). Ordinarily, you'd need to know the root password. Try typing the following to see what I mean:
  
su -
+
<pre>su -</pre>
  
You get prompted for the root password....
+
You are prompted for the root password....
  
 
On an OS X box, your administrator user has sudo rights to execute any command and therefore elevate your shell to be root:
 
On an OS X box, your administrator user has sudo rights to execute any command and therefore elevate your shell to be root:
  
sudo su -
+
<pre>sudo su -</pre>
  
You get prompted for your password.
+
You are prompted for your password.
  
<H4>Installing vi</H4>
+
==Installing vi==
  
 
vi is a line editor for making changes to files. On OS X, vim ([http://www.vim.org/docs.php]) is installed by default.
 
vi is a line editor for making changes to files. On OS X, vim ([http://www.vim.org/docs.php]) is installed by default.
  
To copy them to your AppleTV, first find them. They are both stored under /usr/bin. If you are using a graphical SSH client, you can drag and drop them to your AppleTV (you'll need to copy them to the frontrow user directory - /Users/frontrow). If you're using the command line:
+
To copy them to your AppleTV, first find them. They are both stored under /usr/bin. If you are using a graphical SSH client, you can drag and drop them to your AppleTV (you'll need to copy them to the frontrow user directory - /Users/frontrow). From the command line:
  
scp -1 -r /usr/bin/su frontrow@<AppleTVIPAddress>:~/
+
<pre>scp -1 -r /usr/bin/su frontrow@<AppleTVIPAddress>:~/
scp -1 -r /usr/bin/vim frontrow@<AppleTVIPAddress>:~/
+
scp -1 -r /usr/bin/vim frontrow@<AppleTVIPAddress>:~/</pre>
  
Obviously replace <AppleTVIPAddress> with either the IP address or hostname of your AppleTV. The default hostname is appletv.local.
+
Obviously replace <AppleTVIPAddress> with either the IP address or hostname of your AppleTV. The default hostname is 'appletv.local'.
  
That copied the files to your AppleTV, now we need to move them to their correct location.
+
The previous commands copied the files to your AppleTV; now you need to move them to their correct location.
  
First, log into the AppleTV using ssh:
+
First, ssh into your AppleTV:
  
ssh -1 frontrow@<AppleTVIPAddress>
+
<pre>ssh -1 frontrow@<AppleTVIPAddress></pre>
  
 
When you copied su and vi over from your Mac, you may have inadvertently changed the owner and group of both. To check this:
 
When you copied su and vi over from your Mac, you may have inadvertently changed the owner and group of both. To check this:
  
ls -al
+
<pre>ls -al</pre>
  
 
Now verify correct ownership of the files.
 
Now verify correct ownership of the files.
  
-r-sr-xr-x    1 frontrow  frontrow    44164 Jun 12 02:03 su
+
<pre>-r-sr-xr-x    1 frontrow  frontrow    44164 Jun 12 02:03 su
-rwxr-xr-x    1 frontrow  frontrow  2060380 Jun 12 02:03 vim
+
-rwxr-xr-x    1 frontrow  frontrow  2060380 Jun 12 02:03 vim</pre>
 +
 
 +
If you see 'frontrow' listed where 'root' and 'wheel' should normally be listed, you will want to change the owner and group back to default permissions:
 +
 
 +
<pre>sudo -s
 +
chown root su
 +
chgrp wheel su
 +
chown root vim
 +
chgrp wheel vim</pre>
  
If you see frontrow listed where root and wheel should normally be listed, you will want to change the owner and group back to default permissions:
+
Another 'ls -al' should report this:
  
sudo -s
+
<pre>-r-sr-xr-x    1 root  wheel   44164 Jun 12 02:03 su
chown root su
+
  -rwxr-xr-x    1 root  wheel 2060380 Jun 12 02:03 vim</pre>
  chgrp wheel su
 
  chown root vim
 
  chgrp wheel vim
 
  
You will need to make the boot volume read-writable, if you have not done so already.
+
You will now need to make the boot volume read-writable, if you have not done so already.
  
mount -uw /
+
<pre>mount -uw /</pre>
  
 
Now move the files to the correct location:
 
Now move the files to the correct location:
  
mv su /usr/bin/su
+
<pre>mv su /usr/bin/su
mv vim /usr/bin/vim
+
mv vim /usr/bin/vim</pre>
  
 
If you're used to executing vi rather than vim, create a symbolic link:
 
If you're used to executing vi rather than vim, create a symbolic link:
  
ln -s /usr/bin/vim /usr/bin/vi
+
<pre>ln -s /usr/bin/vim /usr/bin/vi</pre>
  
 
Note that this process can also be utilized to install nano on your AppleTV, if you prefer this text editor over vi.
 
Note that this process can also be utilized to install nano on your AppleTV, if you prefer this text editor over vi.
  
[[Category:How-to]]
+
[[Category:How-to|SU and VI]]

Latest revision as of 17:51, 31 October 2009

The prerequisites for these are running SSH on your AppleTV, and having access to an Intel Mac using universal binaries (except for su; see the note below). This assumes you haven't upgraded the SSH version on your AppleTV (which you should: Install_SSH) and therefore can only connect using SSH v1.

Installing su

Note: you don't need to install su to derive its functionality. To obtain a root shell, simply type 'sudo bash' or 'sudo -s' and enter the password. The prompt will change from a dollar sign (bash-2.05b$) to a hash (bash-2.05b#) to indicate the elevated privileges.

su allows you to login as root ([1]). Ordinarily, you'd need to know the root password. Try typing the following to see what I mean:

su -

You are prompted for the root password....

On an OS X box, your administrator user has sudo rights to execute any command and therefore elevate your shell to be root:

sudo su -

You are prompted for your password.

Installing vi

vi is a line editor for making changes to files. On OS X, vim ([2]) is installed by default.

To copy them to your AppleTV, first find them. They are both stored under /usr/bin. If you are using a graphical SSH client, you can drag and drop them to your AppleTV (you'll need to copy them to the frontrow user directory - /Users/frontrow). From the command line:

scp -1 -r /usr/bin/su frontrow@<AppleTVIPAddress>:~/
scp -1 -r /usr/bin/vim frontrow@<AppleTVIPAddress>:~/

Obviously replace <AppleTVIPAddress> with either the IP address or hostname of your AppleTV. The default hostname is 'appletv.local'.

The previous commands copied the files to your AppleTV; now you need to move them to their correct location.

First, ssh into your AppleTV:

ssh -1 frontrow@<AppleTVIPAddress>

When you copied su and vi over from your Mac, you may have inadvertently changed the owner and group of both. To check this:

ls -al

Now verify correct ownership of the files.

-r-sr-xr-x    1 frontrow  frontrow    44164 Jun 12 02:03 su
-rwxr-xr-x    1 frontrow  frontrow  2060380 Jun 12 02:03 vim

If you see 'frontrow' listed where 'root' and 'wheel' should normally be listed, you will want to change the owner and group back to default permissions:

sudo -s
chown root su
chgrp wheel su
chown root vim
chgrp wheel vim

Another 'ls -al' should report this:

-r-sr-xr-x    1 root  wheel    44164 Jun 12 02:03 su
 -rwxr-xr-x    1 root  wheel  2060380 Jun 12 02:03 vim

You will now need to make the boot volume read-writable, if you have not done so already.

mount -uw /

Now move the files to the correct location:

mv su /usr/bin/su
mv vim /usr/bin/vim

If you're used to executing vi rather than vim, create a symbolic link:

ln -s /usr/bin/vim /usr/bin/vi

Note that this process can also be utilized to install nano on your AppleTV, if you prefer this text editor over vi.