Pogoplug: diferència entre les revisions

De WikiMar
Salta a la navegació Salta a la cerca
Línia 1: Línia 1:
=How to configure a Pogoplug E02 into a NAS server with Rsync, Samba, HDD Automounting, etc., while keeping the Pogoplug services=
<h1>How to configure a Pogoplug E02 into a NAS server with Rsync, Samba, HDD Automounting, etc., while keeping the Pogoplug services</h1>
 
<h2>Backup your Pogoplug system</h2>
==Backup your Pogoplug system==
<p>(optional)
(optional)
</p><p><br />
 
</p>
 
<h2>Install ArchLinux</h2>
==Install ArchLinux==
<p>http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray
http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray
</p><p>Backup of the URL above:
 
</p>
Backup of the URL above:
<pre>
<pre>
With the device on and online, attempt to SSH to the IP the device received through DHCP. If you are unable to SSH, register and enable SSH through my.pogoplug.com. The default login (unless changed through my.pogoplug.com) is root/ceadmin.
With the device on and online, attempt to SSH to the IP the device received through DHCP. If you are unable to SSH, register and enable SSH through my.pogoplug.com. The default login (unless changed through my.pogoplug.com) is root/ceadmin.
Línia 50: Línia 49:
Log back in after your Pogoplug reboots using username root and password root.
Log back in after your Pogoplug reboots using username root and password root.
</pre>
</pre>
 
<p><br />
 
</p>
==Initial setup==
<h2>Initial setup</h2>
 
<p>http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/
http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/
</p><p>After Archlinix installed, login via SSH:
 
</p>
After Archlinix installed, login via SSH:
<pre class="_fck_mw_lspace">username: root
username: root
password: root
password: root
</pre>
 
<p>Cahnge root password:
Cahnge root password:
</p>
passwd root
<pre class="_fck_mw_lspace">passwd root
 
</pre>
Updade the packet repository:
<p>Updade the packet repository:
pacman -Syu
</p>
pacman -Syu
<pre class="_fck_mw_lspace">pacman -Syu
 
pacman -Syu
Choose a hostname:
</pre>
hostnamectl set-hostname ocell
<p>Choose a hostname:
 
</p>
Select correct timezone:
<pre class="_fck_mw_lspace">hostnamectl set-hostname ocell
timedatectl set-timezone Europe/Berlin
</pre>
 
<p>Select correct timezone:
Keep time updated (it may be already done):
</p>
pacman -S openntpd
<pre class="_fck_mw_lspace">timedatectl set-timezone Europe/Berlin
systemctl enable openntpd
</pre>
 
<p>Keep time updated (it may be already done):
Some extra useful tools:
</p>
pacman -S sdparm
<pre class="_fck_mw_lspace">pacman -S openntpd
pacman -S hd-idle
systemctl enable openntpd
pacman -S mc
</pre>
pacman -S vim
<p>Some extra useful tools:
 
</p>
pacman -S rsync
<pre class="_fck_mw_lspace">pacman -S sdparm
pacman -S unison
pacman -S hd-idle
pacman -S autossh
pacman -S mc
 
pacman -S vim
pacman -S screen
</pre>
 
<pre class="_fck_mw_lspace">pacman -S rsync
==Add more users and setup sudo access==
pacman -S unison
useradd marti
pacman -S autossh
..
</pre>
useradd rsync
<pre class="_fck_mw_lspace">pacman -S screen
 
</pre>
mkdir /home/marti
<h2>Add more users and setup sudo access</h2>
mkdir /home/rsync
<pre class="_fck_mw_lspace">useradd marti
 
</pre>
cd /home/rsync
<p>..
mkdir .ssh
</p>
nano authorized_keys
<pre class="_fck_mw_lspace">useradd rsync
chmod 600 authorized_keys
</pre>
 
<pre class="_fck_mw_lspace">mkdir /home/marti
chown marti:marti /home/marti
mkdir /home/rsync
chown rsync:rsync /home/rsync
</pre>
 
<pre class="_fck_mw_lspace">cd /home/rsync
groupadd sudo
mkdir .ssh
usermod -a -G sudo marti
nano authorized_keys
pacman -S sudo
chmod 600 authorized_keys
visudo
</pre>
add
<pre class="_fck_mw_lspace">chown marti:marti /home/marti
%sudo ALL=(ALL) ALL
chown rsync:rsync /home/rsync
 
</pre>
Editar i activar hd-idle
<pre class="_fck_mw_lspace">groupadd sudo
sudo vim /etc/conf.d/hd-idle
usermod -a -G sudo marti
 
pacman -S sudo
==Set up Munin for system monitoring==
visudo
pacman -S munin-node
</pre>
 
<p>add
nano /etc/munin/munin-node.con
</p>
add:
<pre class="_fck_mw_lspace">%sudo ALL=(ALL) ALL
allow ^212\.83\.63\.165$
</pre>
 
<p>Editar i activar hd-idle
 
</p>
munin-node-configure --shell | sh
<pre class="_fck_mw_lspace">sudo vim /etc/conf.d/hd-idle
more info: munin-node-configure --suggest
</pre>
systemctl start munin-node
<h2>Set up Munin for system monitoring</h2>
systemctl enable munin-node
<pre class="_fck_mw_lspace">pacman -S munin-node
 
</pre>
 
<pre class="_fck_mw_lspace">nano /etc/munin/munin-node.con
==Keep a reverse tunnel up to reach the NAS system even when it's installed undere a NAT==
</pre>
nano /root/tunnel-start.sh
<p>add:
</p>
<pre class="_fck_mw_lspace">allow ^212\.83\.63\.165$
</pre>
<p><br />
</p>
<pre class="_fck_mw_lspace">munin-node-configure --shell | sh
</pre>
<p>more info: munin-node-configure --suggest
</p>
<pre class="_fck_mw_lspace">systemctl start munin-node
systemctl enable munin-node
</pre>
<p><br />
</p>
<h2>Keep a reverse tunnel up to reach the NAS system even when it's installed undere a NAT</h2>
<pre class="_fck_mw_lspace">nano /root/tunnel-start.sh
</pre>
<pre>
<pre>
#!/bin/bash
#!/bin/bash


LOGFILE="/root/tunnel-start.log"
LOGFILE=&quot;/root/tunnel-start.log&quot;
DATE=$(date +'%Y-%m-%d %H:%M:%S')
DATE=$(date +'%Y-%m-%d&nbsp;%H:%M:%S')


while [ 1 ]; do
while [ 1 ]; do
  echo "$DATE - Starting autossh" >> $LOGFILE
  echo &quot;$DATE - Starting autossh&quot; &gt;&gt; $LOGFILE
  autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -g -R 0.0.0.0:3322:localhost:22 -R 0.0.0.0:3349:localhost:4949 -p23 [email protected]
  autossh -M 0 -q -N -o &quot;ServerAliveInterval 60&quot; -o &quot;ServerAliveCountMax 3&quot; -g -R 0.0.0.0:3322:localhost:22 -R 0.0.0.0:3349:localhost:4949 -p23 [email protected]
  sleep 5
  sleep 5
done
done
</pre>
</pre>
 
<p><br />
 
</p>
nano /etc/cron.hourly/tunnel-hook
<pre class="_fck_mw_lspace">nano /etc/cron.hourly/tunnel-hook
</pre>
<pre>
<pre>
#!/bin/bash
#!/bin/bash
COMMAND="/root/tunnel-start.sh"
COMMAND=&quot;/root/tunnel-start.sh&quot;
LOGFILE="/root/tunnel-start.log"
LOGFILE=&quot;/root/tunnel-start.log&quot;
DATE=$(date +'%Y-%m-%d %H:%M:%S')
DATE=$(date +'%Y-%m-%d&nbsp;%H:%M:%S')


if [ "$(ps ax | grep tunnel-start.sh | grep -vc grep)" -lt 1 ]; then
if [ &quot;$(ps ax | grep tunnel-start.sh | grep -vc grep)&quot; -lt 1 ]; then
     echo "$DATE - Starting tunnel-start.sh" >> $LOGFILE
     echo &quot;$DATE - Starting tunnel-start.sh&quot; &gt;&gt; $LOGFILE
     $COMMAND &
     $COMMAND &amp;
     exit
     exit
fi
fi
</pre>
</pre>
 
<p><br />
 
</p>
 
<pre class="_fck_mw_lspace">nano /usr/lib/systemd/system/marti-tunnel.service
nano /usr/lib/systemd/system/marti-tunnel.service
</pre>
<pre>
<pre>
[Unit]
[Unit]
Línia 176: Línia 193:
WantedBy=multi-user.target
WantedBy=multi-user.target
</pre>
</pre>
 
<pre class="_fck_mw_lspace">systemctl enable marti-tunnel
systemctl enable marti-tunnel
</pre>
 
<h2>Install Webmin</h2>
==Install Webmin==
<pre class="_fck_mw_lspace">pacman -Sy webmin perl-net-ssleay
 
</pre>
pacman -Sy webmin perl-net-ssleay
<pre class="_fck_mw_lspace">nano /etc/webmin/miniserv.conf
 
</pre>
nano /etc/webmin/miniserv.conf
<p>afegir:
afegir:
</p>
allow=192.168.0.0
<pre class="_fck_mw_lspace">allow=192.168.0.0
 
</pre>
systemctl enable webmin
<pre class="_fck_mw_lspace">systemctl enable webmin
systemctl start webmin
systemctl start webmin
 
</pre>
 
<p><br />
https://deviceip:10000
https://deviceip:10000
To lower memory usage go to:
To lower memory usage go to:
Webmin>Webmin Configuration>Advanced Configuration and disable “Pre-load Webmin functions library?”
Webmin&gt;Webmin Configuration&gt;Advanced Configuration and disable “Pre-load Webmin functions library?”
 
</p><p><br />
 
</p>
==Disks automount==
<h2>Disks automount</h2>
pacman -Sy udevil
<pre class="_fck_mw_lspace">pacman -Sy udevil
 
</pre>
nano /etc/udevil/udevil.conf
<pre class="_fck_mw_lspace">nano /etc/udevil/udevil.conf
Search for default_options_ntfs= and allowed_options=
</pre>
<p>Search for default_options_ntfs= and allowed_options=
Now we add the option “big_writes” to both lines so it looks like:
Now we add the option “big_writes” to both lines so it looks like:
..., noatime, big_writes, uid=...
</p>
 
<pre class="_fck_mw_lspace">..., noatime, big_writes, uid=...
 
</pre>
mkdir /media
<p><br />
 
</p>
systemctl enable devmon@root
<pre class="_fck_mw_lspace">mkdir /media
or better, so that the rsync user can set times and perms (use "--modify-window=2 --no-perms" in rsync):
</pre>
systemctl enable devmon@rsync
<pre class="_fck_mw_lspace">systemctl enable devmon@root
 
</pre>
reboot
<p>or better, so that the rsync user can set times and perms (use "--modify-window=2 --no-perms" in rsync):
 
</p>
==Samba==
<pre class="_fck_mw_lspace">systemctl enable devmon@rsync
 
</pre>
 
<pre class="_fck_mw_lspace">reboot
==Colors==
</pre>
 
<h2>Samba</h2>
mv /etc/bash.bashrc /etc/bash.bashrc-ORIGINAL
<h2>Colors</h2>
nano /etc/bash.bashrc
<pre class="_fck_mw_lspace">mv /etc/bash.bashrc /etc/bash.bashrc-ORIGINAL
 
nano /etc/bash.bashrc
</pre>
<pre>
<pre>
# /etc/bash.bashrc
# /etc/bash.bashrc
Línia 229: Línia 248:
# including some apparently interactive shells such as scp and rcp
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# anything or bad things will happen&nbsp;!


# Test for an interactive shell. There is no need to set anything
# Test for an interactive shell. There is no need to set anything
Línia 236: Línia 255:


# If not running interactively, don't do anything!
# If not running interactively, don't do anything!
[[ $- != *i* ]] && return
[[ $-&nbsp;!= *i* ]] &amp;&amp; return


# Bash won't get SIGWINCH if another process is in the foreground.
# Bash won't get SIGWINCH if another process is in the foreground.
Línia 249: Línia 268:
case ${TERM} in
case ${TERM} in
         xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
         xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
                 PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                 PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf &quot;\033]0;%s@%s:%s\007&quot; &quot;${USER}&quot; &quot;${HOSTNAME%%.*}&quot; &quot;${PWD/#$HOME/~}&quot;'
                ;;
              &nbsp;;;
         screen)
         screen)
                 PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                 PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf &quot;\033_%s@%s:%s\033\\&quot; &quot;${USER}&quot; &quot;${HOSTNAME%%.*}&quot; &quot;${PWD/#$HOME/~}&quot;'
                ;;
              &nbsp;;;
esac
esac


# fortune is a simple program that displays a pseudorandom message
# fortune is a simple program that displays a pseudorandom message
# from a database of quotations at logon and/or logout.
# from a database of quotations at logon and/or logout.
# Type: "pacman -S fortune-mod" to install it, then uncomment the
# Type: &quot;pacman -S fortune-mod&quot; to install it, then uncomment the
# following line:
# following line:


# [[ "$PS1" ]] && /usr/bin/fortune
# [[ &quot;$PS1&quot; ]] &amp;&amp; /usr/bin/fortune


# Welcome Message
# Welcome Message
# Arch Linux Logo Welcome Message
# Arch Linux Logo Welcome Message
c1="$(tput sgr0)$(tput setaf 4)"
c1=&quot;$(tput sgr0)$(tput setaf 4)&quot;
c2="$(tput bold)$(tput setaf 4)"
c2=&quot;$(tput bold)$(tput setaf 4)&quot;
c3="$(tput bold)$(tput setaf 7)"
c3=&quot;$(tput bold)$(tput setaf 7)&quot;
echo
echo
echo "       $c2,$c1                      _    _ _"
echo &quot;       $c2,$c1                      _    _ _&quot;
echo "       $c2/$c1#$c2\\$c1        __ _ _ __ ___| |__ | (_)_ __  _  ___  __"
echo &quot;       $c2/$c1#$c2\\$c1        __ _ _ __ ___| |__ | (_)_ __  _  ___  __&quot;
echo "     $c2/$c1###$c2\\$c1      / _\` | '__/ __| '_ \\| | | '_ \\| | | \\ \\/ /"
echo &quot;     $c2/$c1###$c2\\$c1      / _\` | '__/ __| '_ \\| | | '_ \\| | | \\ \\/ /&quot;
echo "     $c2/$c1#####$c2\\$c1    | (_| | | | (__| | | | | | | | | |_| |> <"
echo &quot;     $c2/$c1#####$c2\\$c1    | (_| | | | (__| | | | | | | | | |_| |&gt; &lt;&quot;
echo "   $c2/$c1##,-,##$c2\\$c1    \\__,_|_|  \\___|_| |_|_|_|_| |_|\\__,_/_/\\_\\"
echo &quot;   $c2/$c1##,-,##$c2\\$c1    \\__,_|_|  \\___|_| |_|_|_|_| |_|\\__,_/_/\\_\\&quot;
echo "   $c2/$c1##(  )##$c2\\$c1"
echo &quot;   $c2/$c1##(  )##$c2\\$c1&quot;
echo " $c2/$c1#.--  --.#$c2\\  $c3 A simple, elegant GNU/Linux distribution."
echo &quot; $c2/$c1#.--  --.#$c2\\  $c3 A simple, elegant GNU/Linux distribution.&quot;
echo " $c2/$c1\`          \`$c2\\$(tput sgr0)"$'\n'
echo &quot; $c2/$c1\`          \`$c2\\$(tput sgr0)&quot;$'\n'


# Show date
# Show date
DATE="$(tput setaf 1)[$(tput setaf 6)$(date)"
DATE=&quot;$(tput setaf 1)[$(tput setaf 6)$(date)&quot;
DATE="${DATE}$(tput setaf 1)]"
DATE=&quot;${DATE}$(tput setaf 1)]&quot;
echo $DATE
echo $DATE
# Show kernel info
# Show kernel info
KERNEL="$(tput setaf 1)[$(tput setaf 6)$(uname -srmn)"
KERNEL=&quot;$(tput setaf 1)[$(tput setaf 6)$(uname -srmn)&quot;
KERNEL="${KERNEL}$(tput setaf 1)]"
KERNEL=&quot;${KERNEL}$(tput setaf 1)]&quot;
echo "$KERNEL"$'\n'
echo &quot;$KERNEL&quot;$'\n'
# Reset colors
# Reset colors
tput sgr0
tput sgr0
Línia 297: Línia 316:
# sanitize TERM:
# sanitize TERM:
safe_term=${TERM//[^[:alnum:]]/?}
safe_term=${TERM//[^[:alnum:]]/?}
match_lhs=""
match_lhs=&quot;&quot;


[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f ~/.dir_colors ]] &amp;&amp; match_lhs=&quot;${match_lhs}$(&lt;~/.dir_colors)&quot;
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -f /etc/DIR_COLORS ]] &amp;&amp; match_lhs=&quot;${match_lhs}$(&lt;/etc/DIR_COLORS)&quot;
[[ -z ${match_lhs} ]] \
[[ -z ${match_lhs} ]] \
         && type -P dircolors >/dev/null \
         &amp;&amp; type -P dircolors &gt;/dev/null \
         && match_lhs=$(dircolors --print-database)
         &amp;&amp; match_lhs=$(dircolors --print-database)


if [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] ; then
if [[ $'\n'${match_lhs} == *$'\n'&quot;TERM &quot;${safe_term}* ]]&nbsp;; then


         # we have colors <img src="http://obihoernchen.net/wordpress/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley">
         # we have colors &lt;img src=&quot;http://obihoernchen.net/wordpress/wp-includes/images/smilies/icon_smile.gif&quot; alt=&quot;:-)&quot; class=&quot;wp-smiley&quot;&gt;


         # Enable colors for ls, etc. Prefer ~/.dir_colors
         # Enable colors for ls, etc. Prefer ~/.dir_colors
         if type -P dircolors >/dev/null ; then
         if type -P dircolors &gt;/dev/null&nbsp;; then
                 if [[ -f ~/.dir_colors ]] ; then
                 if [[ -f ~/.dir_colors ]]&nbsp;; then
                         eval $(dircolors -b ~/.dir_colors)
                         eval $(dircolors -b ~/.dir_colors)
                 elif [[ -f /etc/DIR_COLORS ]] ; then
                 elif [[ -f /etc/DIR_COLORS ]]&nbsp;; then
                         eval $(dircolors -b /etc/DIR_COLORS)
                         eval $(dircolors -b /etc/DIR_COLORS)
                 fi
                 fi
Línia 320: Línia 339:
         # -- CUSTOM PS1 String START --
         # -- CUSTOM PS1 String START --


         PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]"
         PS1=&quot;\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$?&nbsp;!= 0 ]] &amp;&amp; echo \&quot;[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\&quot;)[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]&quot;
         # --- Custom PS1 String END ---
         # --- Custom PS1 String END ---


         # Use this other PS1 string if you want \W for root and \w for all other users:
         # Use this other PS1 string if you want \W for root and \w for all other users:
         # PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\$\[\033[00m\] "
         # PS1=&quot;$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$?&nbsp;!= 0 ]] &amp;&amp; echo \&quot;\[\033[01;31m\]:(\[\033[01;34m\] \&quot;)\$\[\033[00m\] &quot;


         alias ls="ls --color=auto"
         alias ls=&quot;ls --color=auto&quot;
         alias dir="dir --color=auto"
         alias dir=&quot;dir --color=auto&quot;
         alias grep="grep --colour=auto"
         alias grep=&quot;grep --colour=auto&quot;


else
else
Línia 334: Línia 353:
         # show root@ when we do not have colors
         # show root@ when we do not have colors


         PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ "
         PS1=&quot;\u@\h \w \$([[ \$?&nbsp;!= 0 ]] &amp;&amp; echo \&quot;:( \&quot;)\$ &quot;


         # Use this other PS1 string if you want \W for root and \w for all other users:
         # Use this other PS1 string if you want \W for root and \w for all other users:
         # PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$? != 0 ]] && echo \":( \")\$ "
         # PS1=&quot;\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$?&nbsp;!= 0 ]] &amp;&amp; echo \&quot;:( \&quot;)\$ &quot;


fi
fi


PS2="> "
PS2=&quot;&gt; &quot;
PS3="> "
PS3=&quot;&gt; &quot;
PS4="+ "
PS4=&quot;+ &quot;


# Try to keep environment pollution down, EPA loves us.
# Try to keep environment pollution down, EPA loves us.
unset safe_term match_lhs
unset safe_term match_lhs


# Try to enable the auto-completion (type: "pacman -S bash-completion" to install it).
# Try to enable the auto-completion (type: &quot;pacman -S bash-completion&quot; to install it).
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
[ -r /usr/share/bash-completion/bash_completion ] &amp;&amp; . /usr/share/bash-completion/bash_completion


# Try to enable the "Command not found" hook ("pacman -S pkgfile" to install it).
# Try to enable the &quot;Command not found&quot; hook (&quot;pacman -S pkgfile&quot; to install it).
# See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook
# See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] &amp;&amp; . /usr/share/doc/pkgfile/command-not-found.bash




# Afegit Marti:
# Afegit Marti:


if [[ ${EUID} == 0 ]] ; then
if [[ ${EUID} == 0 ]]&nbsp;; then
   PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
   PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
else
Línia 365: Línia 384:


# If this is an xterm set the title to user@host:dir
# If this is an xterm set the title to user@host:dir
case "$TERM" in
case &quot;$TERM&quot; in
xterm*|rxvt*)
xterm*|rxvt*)
   PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
   PS1=&quot;\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1&quot;
  ;;
  &nbsp;;;
*)
*)
  ;;
  &nbsp;;;
esac
esac


# enable color support of ls and also add handy aliases
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
if [ -x /usr/bin/dircolors ]; then
     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
     test -r ~/.dircolors &amp;&amp; eval &quot;$(dircolors -b ~/.dircolors)&quot; || eval &quot;$(dircolors -b)&quot;
     alias ls='ls --color=auto'
     alias ls='ls --color=auto'
     alias dir='dir --color=auto'
     alias dir='dir --color=auto'
Línia 389: Línia 408:


</pre>
</pre>
 
<p><br />
 
</p>
nano /etc/DIR_COLORS
<pre class="_fck_mw_lspace">nano /etc/DIR_COLORS
 
</pre>
<pre>
<pre>
# Configuration file for the color ls utility
# Configuration file for the color ls utility
Línia 481: Línia 500:


</pre>
</pre>
 
<h2>Samba</h2>
==Samba==
<p>More info: http://blog.qnology.com/2013/03/tutorial-pogoplug-e02-with-arch-linux.html
More info: http://blog.qnology.com/2013/03/tutorial-pogoplug-e02-with-arch-linux.html
</p>
 
<pre class="_fck_mw_lspace">pacman -Sy samba
pacman -Sy samba
</pre>
 
<pre class="_fck_mw_lspace">cd /etc/samba
cd /etc/samba
wget http://dl.dropbox.com/u/42238/pogoplug/v2/smb.conf
wget http://dl.dropbox.com/u/42238/pogoplug/v2/smb.conf
</pre>
 
<pre class="_fck_mw_lspace">nano /etc/samba/smb.conf
nano /etc/samba/smb.conf
</pre>
<pre>
<pre>
[global]
[global]
Línia 527: Línia 546:
   guest ok = yes
   guest ok = yes
</pre>
</pre>
 
<pre class="_fck_mw_lspace">systemctl start smbd nmbd
systemctl start smbd nmbd
systemctl enable smbd nmbd
systemctl enable smbd nmbd
</pre>
 
<p>No se si cal:
No se si cal:
</p>
systemctl enable samba
<pre class="_fck_mw_lspace">systemctl enable samba
groupadd samba
groupadd samba
 
</pre>
....
<p>....
 
</p><p><br />
 
</p>
==REinstall my.pogoplug.com service==
<h2>REinstall my.pogoplug.com service</h2>
http://archlinuxarm.org/forum/viewtopic.php?t=3343
<p>http://archlinuxarm.org/forum/viewtopic.php?t=3343
 
</p><p>Backup of the URL:
Backup of the URL:
</p>
<pre>
<pre>
Updated: May 28 2013
Updated: May 28 2013
Línia 558: Línia 577:
1. Run  
1. Run  
CODE: SELECT ALL
CODE: SELECT ALL
/usr/local/cloudengines/bin/hbplug | grep "Device ID"
/usr/local/cloudengines/bin/hbplug | grep &quot;Device ID&quot;


and take note of the shown Device ID. We are interested in this line, particularly the string in red  
and take note of the shown Device ID. We are interested in this line, particularly the string in red  
Línia 566: Línia 585:
nano /usr/local/cloudengines/bin/hbplug.conf
nano /usr/local/cloudengines/bin/hbplug.conf


the line "svcid=" should now be "svcid=8C3CUTEY6MNGHLCV9FYVUNEZCN"
the line &quot;svcid=&quot; should now be &quot;svcid=8C3CUTEY6MNGHLCV9FYVUNEZCN&quot;
3. Now run
3. Now run
CODE: SELECT ALL
CODE: SELECT ALL
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
/usr/local/cloudengines/bin/hbplug | grep &quot;CRYPTO&quot;
several times until it reads CRYPTO KEY: VALID
several times until it reads CRYPTO KEY: VALID
Wait a reasonable amount of time before CTRL+C'ing it (60 sec?)
Wait a reasonable amount of time before CTRL+C'ing it (60 sec?)
Línia 580: Línia 599:


A couple of points:
A couple of points:
- config file location /etc/pogoplug.conf --> EDIT IT to get directories visible at my.pogoplug.com
- config file location /etc/pogoplug.conf --&gt; EDIT IT to get directories visible at my.pogoplug.com
- Format: vfsdir<number>=<name>,<path>
- Format: vfsdir&lt;number&gt;=&lt;name&gt;,&lt;path&gt;
- Example: vfsdir0=plugdata,/media/2TBDrive/Downloads
- Example: vfsdir0=plugdata,/media/2TBDrive/Downloads
- Don't change order of variables. Add more directories under each other. E.g Line1: vfsdir0=.. Line2: vfsdir1=..
- Don't change order of variables. Add more directories under each other. E.g Line1: vfsdir0=.. Line2: vfsdir1=..
Línia 588: Línia 607:
Don't forget to (re)register your device at my.pogoplug.com.  
Don't forget to (re)register your device at my.pogoplug.com.  
</pre>
</pre>
 
<p><br />
 
Steps followed:
Steps followed:
 
</p><p><br />
 
</p>
pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/pogoplug-3.3.0-5-arm.pkg.tar.xz
<pre class="_fck_mw_lspace">pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/pogoplug-3.3.0-5-arm.pkg.tar.xz
 
</pre>
nano /usr/local/cloudengines/hbplug.conf
<pre class="_fck_mw_lspace">nano /usr/local/cloudengines/hbplug.conf
edit
</pre>
installdir=/usr/local/cloudengines
<p>edit
datadir=./T3000_64k_Backup_U/
</p>
vfsdir0=PogoPlug_USB,/media
<pre class="_fck_mw_lspace">installdir=/usr/local/cloudengines
nohotplug=1
datadir=./T3000_64k_Backup_U/
svcid=53UFGEBGD77LEYKX73YFCM6XPW
vfsdir0=PogoPlug_USB,/media
 
nohotplug=1
ocell2
svcid=53UFGEBGD77LEYKX73YFCM6XPW
3WQMBM9WNJ32H25LKGWHDDCDP6
</pre>
 
<p>ocell2
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
</p>
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
<pre class="_fck_mw_lspace">3WQMBM9WNJ32H25LKGWHDDCDP6
 
</pre>
mv /usr/local/cloudengines/hbplug.conf /etc/pogoplug.conf
<pre class="_fck_mw_lspace">/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
 
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
systemctl enable pogoplug
</pre>
 
<pre class="_fck_mw_lspace">mv /usr/local/cloudengines/hbplug.conf /etc/pogoplug.conf
==Update Kernel==
</pre>
Optional (Not sure if it's needed).
<pre class="_fck_mw_lspace">systemctl enable pogoplug
 
</pre>
http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/
<h2>Update Kernel</h2>
 
<p>Optional (Not sure if it's needed).
Backup of the URL above:
</p><p>http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/
</p><p>Backup of the URL above:
</p>
<pre>
<pre>
8. Update Kernel to >3.2
8. Update Kernel to &gt;3.2
Warning: This specific instruction works for PogoplugV2 only!
Warning: This specific instruction works for PogoplugV2 only!
You can brick your device!
You can brick your device!
Línia 627: Línia 647:
You have to update manually because newer kernels need a new uboot.
You have to update manually because newer kernels need a new uboot.


You need the newest uboot to boot Kernels >3.2 so you have to install it before:
You need the newest uboot to boot Kernels &gt;3.2 so you have to install it before:
If this is a fresh installation you probably have the newest uboot already and you don’t have to do that!
If this is a fresh installation you probably have the newest uboot already and you don’t have to do that!


Línia 648: Línia 668:
reboot
reboot
</pre>
</pre>
 
<p><br />
 
</p>
==Keep dynamic DNS updated from dyndns.org==
<h2>Keep dynamic DNS updated from dyndns.org</h2>
pacman -S ddclient
<pre class="_fck_mw_lspace">pacman -S ddclient
 
</pre>
vim /etc/ddclient/ddclient.conf
<pre class="_fck_mw_lspace">vim /etc/ddclient/ddclient.conf
 
</pre>
<pre>
<pre>
# Basic HTTPS configuration file for ddclient
# Basic HTTPS configuration file for ddclient
Línia 671: Línia 691:
#custom=yes, example.com
#custom=yes, example.com
</pre>
</pre>
More info: http://dyn.com/support/clients/linux/ddclient/
<p>More info: http://dyn.com/support/clients/linux/ddclient/
</p>

Revisió del 23:45, 13 nov 2013

How to configure a Pogoplug E02 into a NAS server with Rsync, Samba, HDD Automounting, etc., while keeping the Pogoplug services

Backup your Pogoplug system

(optional)


Install ArchLinux

http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray

Backup of the URL above:

With the device on and online, attempt to SSH to the IP the device received through DHCP. If you are unable to SSH, register and enable SSH through my.pogoplug.com. The default login (unless changed through my.pogoplug.com) is root/ceadmin.
Stop the Pogoplug software, so it doesn't interfere with the install process:killall hbwd
You only need to kill the Pogoplug service the first time you SSH in. Running the installer in the following steps disables it completely.

While connected via SSH to your plug, copy, paste, and run the following commands to download a bootloader that can boot from USB drives:
cd /tmp
wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh
After the new bootloader is installed, you will need to use fdisk to partition a storage device. Plug in a 1GB or bigger USB drive. REMOVE ALL OTHER DRIVES. Move everything you need off of the Arch Linux ARM drive and back it up. Everything on the USB drive with be deleted and replaced with Arch Linux ARM.

Set the U-Boot variable to tell the kernel to use ext3:
/usr/sbin/fw_setenv usb_rootfstype ext3
Start fdisk on the USB drive:
/sbin/fdisk /dev/sda
At the fdisk prompt, delete old partitions and create a new one:
Type o. This will clear out any partitions on the drive.
Type p to list partitions. There should be no partitions left.
Now type n, then p for primary, 1 for the first partition on the drive, and then press ENTER, accepting default values.
Exit by typing w.
Now create the ext3 filesystem:
wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod 755 mke2fs
./mke2fs -j /dev/sda1
mkdir usb
mount /dev/sda1 usb
Download and install Arch Linux ARM:
cd usb
wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
tar -xzvf ArchLinuxARM-armv5te-*.tar.gz  # This will take a long time
rm ArchLinuxARM-armv5te-*.tar.gz
sync  # Takes a while when using a flash drive
Clean up and reboot. Cross your fingers and hope for the best.
cd ..
umount usb
/sbin/reboot
The SSH key of your device will be different, so you need to tell Mac OS X or Linux to remove it from ~/.ssh/known_hosts before using SSH again:
ssh-keygen -R 192.168.1.123 # Use your device's IP
Log back in after your Pogoplug reboots using username root and password root.


Initial setup

http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/

After Archlinix installed, login via SSH:

username: root
password: root

Cahnge root password:

passwd root

Updade the packet repository:

pacman -Syu
pacman -Syu

Choose a hostname:

hostnamectl set-hostname ocell

Select correct timezone:

timedatectl set-timezone Europe/Berlin

Keep time updated (it may be already done):

pacman -S openntpd
systemctl enable openntpd

Some extra useful tools:

pacman -S sdparm
pacman -S hd-idle
pacman -S mc
pacman -S vim
pacman -S rsync
pacman -S unison
pacman -S autossh
pacman -S screen

Add more users and setup sudo access

useradd marti

..

useradd rsync
mkdir /home/marti
mkdir /home/rsync
cd /home/rsync
mkdir .ssh
nano authorized_keys
chmod 600 authorized_keys
chown marti:marti /home/marti
chown rsync:rsync /home/rsync
groupadd sudo
usermod -a -G sudo marti
pacman -S sudo
visudo

add

%sudo ALL=(ALL) ALL

Editar i activar hd-idle

sudo vim /etc/conf.d/hd-idle

Set up Munin for system monitoring

pacman -S munin-node
nano /etc/munin/munin-node.con

add:

allow ^212\.83\.63\.165$


munin-node-configure --shell | sh

more info: munin-node-configure --suggest

systemctl start munin-node
systemctl enable munin-node


Keep a reverse tunnel up to reach the NAS system even when it's installed undere a NAT

nano /root/tunnel-start.sh
#!/bin/bash

LOGFILE="/root/tunnel-start.log"
DATE=$(date +'%Y-%m-%d %H:%M:%S')

while [ 1 ]; do
 echo "$DATE - Starting autossh" >> $LOGFILE
 autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -g -R 0.0.0.0:3322:localhost:22 -R 0.0.0.0:3349:localhost:4949 -p23 [email protected]
 sleep 5
done


nano /etc/cron.hourly/tunnel-hook
#!/bin/bash
COMMAND="/root/tunnel-start.sh"
LOGFILE="/root/tunnel-start.log"
DATE=$(date +'%Y-%m-%d %H:%M:%S')

if [ "$(ps ax | grep tunnel-start.sh | grep -vc grep)" -lt 1 ]; then
    echo "$DATE - Starting tunnel-start.sh" >> $LOGFILE
    $COMMAND &
    exit
fi


nano /usr/lib/systemd/system/marti-tunnel.service
[Unit]
Description=Tunnel

[Service]
Type=oneshot
ExecStart=/etc/cron.hourly/tunnel-hook
ExecReload=/etc/cron.hourly/tunnel-hook

RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
systemctl enable marti-tunnel

Install Webmin

pacman -Sy webmin perl-net-ssleay
nano /etc/webmin/miniserv.conf

afegir:

allow=192.168.0.0
systemctl enable webmin
systemctl start webmin


https://deviceip:10000 To lower memory usage go to: Webmin>Webmin Configuration>Advanced Configuration and disable “Pre-load Webmin functions library?”


Disks automount

pacman -Sy udevil
nano /etc/udevil/udevil.conf

Search for default_options_ntfs= and allowed_options= Now we add the option “big_writes” to both lines so it looks like:

..., noatime, big_writes, uid=...


mkdir /media
systemctl enable devmon@root

or better, so that the rsync user can set times and perms (use "--modify-window=2 --no-perms" in rsync):

systemctl enable devmon@rsync
reboot

Samba

Colors

mv /etc/bash.bashrc /etc/bash.bashrc-ORIGINAL
nano /etc/bash.bashrc
# /etc/bash.bashrc
#
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.

# If not running interactively, don't do anything!
[[ $- != *i* ]] && return

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.
shopt -s histappend

case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
                PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                ;;
        screen)
                PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                ;;
esac

# fortune is a simple program that displays a pseudorandom message
# from a database of quotations at logon and/or logout.
# Type: "pacman -S fortune-mod" to install it, then uncomment the
# following line:

# [[ "$PS1" ]] && /usr/bin/fortune

# Welcome Message
# Arch Linux Logo Welcome Message
c1="$(tput sgr0)$(tput setaf 4)"
c2="$(tput bold)$(tput setaf 4)"
c3="$(tput bold)$(tput setaf 7)"
echo
echo "        $c2,$c1                       _     _ _"
echo "       $c2/$c1#$c2\\$c1        __ _ _ __ ___| |__ | (_)_ __  _   ___  __"
echo "      $c2/$c1###$c2\\$c1      / _\` | '__/ __| '_ \\| | | '_ \\| | | \\ \\/ /"
echo "     $c2/$c1#####$c2\\$c1    | (_| | | | (__| | | | | | | | | |_| |>  <"
echo "    $c2/$c1##,-,##$c2\\$c1    \\__,_|_|  \\___|_| |_|_|_|_| |_|\\__,_/_/\\_\\"
echo "   $c2/$c1##(   )##$c2\\$c1"
echo "  $c2/$c1#.--   --.#$c2\\  $c3 A simple, elegant GNU/Linux distribution."
echo " $c2/$c1\`           \`$c2\\$(tput sgr0)"$'\n'

# Show date
DATE="$(tput setaf 1)[$(tput setaf 6)$(date)"
DATE="${DATE}$(tput setaf 1)]"
echo $DATE
# Show kernel info
KERNEL="$(tput setaf 1)[$(tput setaf 6)$(uname -srmn)"
KERNEL="${KERNEL}$(tput setaf 1)]"
echo "$KERNEL"$'\n'
# Reset colors
tput sgr0

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.

# sanitize TERM:
safe_term=${TERM//[^[:alnum:]]/?}
match_lhs=""

[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
        && type -P dircolors >/dev/null \
        && match_lhs=$(dircolors --print-database)

if [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] ; then

        # we have colors <img src="http://obihoernchen.net/wordpress/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"> 

        # Enable colors for ls, etc. Prefer ~/.dir_colors
        if type -P dircolors >/dev/null ; then
                if [[ -f ~/.dir_colors ]] ; then
                        eval $(dircolors -b ~/.dir_colors)
                elif [[ -f /etc/DIR_COLORS ]] ; then
                        eval $(dircolors -b /etc/DIR_COLORS)
                fi
        fi

        # -- CUSTOM PS1 String START --

        PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]"
        # --- Custom PS1 String END ---

        # Use this other PS1 string if you want \W for root and \w for all other users:
        # PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\$\[\033[00m\] "

        alias ls="ls --color=auto"
        alias dir="dir --color=auto"
        alias grep="grep --colour=auto"

else

        # show root@ when we do not have colors

        PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ "

        # Use this other PS1 string if you want \W for root and \w for all other users:
        # PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$? != 0 ]] && echo \":( \")\$ "

fi

PS2="> "
PS3="> "
PS4="+ "

# Try to keep environment pollution down, EPA loves us.
unset safe_term match_lhs

# Try to enable the auto-completion (type: "pacman -S bash-completion" to install it).
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

# Try to enable the "Command not found" hook ("pacman -S pkgfile" to install it).
# See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash


# Afegit Marti:

if [[ ${EUID} == 0 ]] ; then
  PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
  PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
   PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
   ;;
*)
   ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

alias l='ls -alF'
alias ..='cd ..'
alias ...='cd ../..'


nano /etc/DIR_COLORS
# Configuration file for the color ls utility
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.

# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR all

# Extra command line options for ls go here.
# Basically these ones are:
#  -F = show '/' for dirs, '*' for executables, etc.
#  -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM xterm
TERM vt100
TERM rxvt
TERM rxvt-256color
TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM rxvt-unicode-256color
TERM rxvt-unicode256

# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes: 
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00	# global default, although everything should be something.
FILE 00 	# normal file
DIR 01;34 	# directory
LINK 01;36 	# symbolic link
FIFO 40;33	# pipe
SOCK 01;35	# socket
BLK 40;33;01	# block device driver
CHR 40;33;01 	# character device driver

# This is for files with execute permission:
EXEC 01;32 

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z   01;31
.Z   01;31
.gz  01;31
.jpg 01;35 # image formats
.gif 01;35
.bmp 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35

Samba

More info: http://blog.qnology.com/2013/03/tutorial-pogoplug-e02-with-arch-linux.html

pacman -Sy samba
cd /etc/samba
wget http://dl.dropbox.com/u/42238/pogoplug/v2/smb.conf
nano /etc/samba/smb.conf
[global]
 workgroup = MIN_LAN
 server string = OCELL
 netbios name = OCELL
 load printers = no
 printing = bsd
 printcap name = /dev/null
 disable spoolss = yes
 log file = /var/log/samba/%m.log
 max log size = 50
 socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
 write cache size = 2097152
 use sendfile = yes

 #unprotected/public share without login
 security = user
 map to guest = Bad User
 guest account = root

#[root$]
#  path = /
#  read only = no
#  public = yes
#  writable = yes
#  #force user = root
#  guest ok = yes

[usb]
  path = /media
  read only = no
  public = yes
  writable = yes
  #force user = root
  guest ok = yes
systemctl start smbd nmbd
systemctl enable smbd nmbd

No se si cal:

systemctl enable samba
groupadd samba

....


REinstall my.pogoplug.com service

http://archlinuxarm.org/forum/viewtopic.php?t=3343

Backup of the URL:

Updated: May 28 2013
- Changed location of hbplug.conf (now it's copied to /usr/local/cloudengines/ and not /usr/local/cloudengines/bin)
- I found no reliable way to generate the service id, so now on you have to do it manually. There's no default /etc/pogoplug.conf

Install with:
CODE: SELECT ALL
pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/pogoplug-3.3.0-5-arm.pkg.tar.xz


Getting service ID and a proper CRYPTO KEY:
There are several ways to do this, I'll explain one here:

If you are copying the svcid from the bottom of the device skip this step.
1. Run 
CODE: SELECT ALL
/usr/local/cloudengines/bin/hbplug | grep "Device ID"

and take note of the shown Device ID. We are interested in this line, particularly the string in red 
[060343.931][MAIN ][HBPLUG][08] Device ID: 8C3CUTEY6MNGHLCV9FYVUNEZCN
2. Edit /usr/local/cloudengines/bin/hbplug.conf and add your svcid, either the one that you noted above, or the one from the bottom of the device:
CODE: SELECT ALL
nano /usr/local/cloudengines/bin/hbplug.conf

the line "svcid=" should now be "svcid=8C3CUTEY6MNGHLCV9FYVUNEZCN"
3. Now run
CODE: SELECT ALL
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
several times until it reads CRYPTO KEY: VALID
Wait a reasonable amount of time before CTRL+C'ing it (60 sec?)
If after 5 runs it doesn't work, reboot and do the same thing until it works. It will eventually.
4. Now you should be set, just move the hbplug.conf to /etc as pogoplug.conf
CODE: SELECT ALL
mv /usr/local/cloudengines/bin/hbplug.conf /etc/pogoplug.conf

Now you can edit /etc/pogoplug.conf to include the directories that you want to be visible by the my.pogoplug.com service

A couple of points:
- config file location /etc/pogoplug.conf --> EDIT IT to get directories visible at my.pogoplug.com
- Format: vfsdir<number>=<name>,<path>
- Example: vfsdir0=plugdata,/media/2TBDrive/Downloads
- Don't change order of variables. Add more directories under each other. E.g Line1: vfsdir0=.. Line2: vfsdir1=..
- includes pogoplug.service for systemd and pogoplug initscript for sysv

Don't forget to (re)register your device at my.pogoplug.com. 


Steps followed:


pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/pogoplug-3.3.0-5-arm.pkg.tar.xz
nano /usr/local/cloudengines/hbplug.conf

edit

installdir=/usr/local/cloudengines
datadir=./T3000_64k_Backup_U/
vfsdir0=PogoPlug_USB,/media
nohotplug=1
svcid=53UFGEBGD77LEYKX73YFCM6XPW

ocell2

3WQMBM9WNJ32H25LKGWHDDCDP6
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
/usr/local/cloudengines/bin/hbplug | grep "CRYPTO"
mv /usr/local/cloudengines/hbplug.conf /etc/pogoplug.conf
systemctl enable pogoplug

Update Kernel

Optional (Not sure if it's needed).

http://obihoernchen.net/wordpress/770/plug_computer_arch_linux/

Backup of the URL above:

8. Update Kernel to >3.2
Warning: This specific instruction works for PogoplugV2 only!
You can brick your device!

The current kernel for PogoplugV2 is 3.1.x but 3.8.x or newer is available.
You have to update manually because newer kernels need a new uboot.

You need the newest uboot to boot Kernels >3.2 so you have to install it before:
If this is a fresh installation you probably have the newest uboot already and you don’t have to do that!


cd /tmp
wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh
Then you have to correct your arcNumber and matchid if you didn’t follow “Blink LED to HDD activity”.


pacman -Sy uboot-env
fw_setenv arcNumber 3542
fw_setenv machid dd6
reboot
Now you can install the new Kernel files with:


pacman -Sy linux-kirkwood linux-headers-kirkwood
reboot


Keep dynamic DNS updated from dyndns.org

pacman -S ddclient
vim /etc/ddclient/ddclient.conf
# Basic HTTPS configuration file for ddclient
#
# /etc/ddclient.conf
daemon=600
pid=/var/run/ddclient.pid
ssl=yes
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
login=your-username
password=your-password
protocol=dyndns2
server=members.dyndns.org
wildcard=YES
example.dyndns.info
#custom=yes, example.com

More info: http://dyn.com/support/clients/linux/ddclient/