84 lines
1.2 KiB
Markdown
84 lines
1.2 KiB
Markdown
# Bash
|
|
|
|
### Installer le shell Bash:
|
|
|
|
Se connecter sous root
|
|
|
|
```bash
|
|
ssh root@192.168.0.8
|
|
```
|
|
|
|
Installer le package **Bash** avec **ipkg**
|
|
|
|
```bash
|
|
DiskStation$> ipkg install -A bash
|
|
```
|
|
|
|
------
|
|
|
|
Pour avoir bash au log-in, il faut éditer le fichier **/etc/passwd**
|
|
|
|
```bash
|
|
DiskStation$> nano /etc/passwd
|
|
```
|
|
|
|
et remplacer la ligne
|
|
|
|
```bash
|
|
root:x:0:0:root:/root:/bin/ash
|
|
```
|
|
|
|
par
|
|
|
|
```bash
|
|
root:x:0:0:root:/root:/bin/bash
|
|
```
|
|
|
|
!!! attention "Attention, une m-à-j Synology peut supprimer /opt/bin/bash."
|
|
Aussi, il est préférable de garder ash pour se logger et de démarrer bash ensuite.
|
|
|
|
On va éditer le fichier `.profile`:
|
|
|
|
```bash
|
|
DiskStation$> nano .profile
|
|
```
|
|
|
|
et y ajouter les lignes suivantes:
|
|
|
|
```bash
|
|
if [[ -x /opt/bin/bash ]]; then
|
|
exec /opt/bin/bash
|
|
fi
|
|
```
|
|
|
|
------
|
|
|
|
### Configurer bash:
|
|
|
|
On va créer un fichier .bashrc:
|
|
|
|
```bash
|
|
DiskStation$> nano .bashrc
|
|
```
|
|
|
|
et y ajouter:
|
|
|
|
```bash
|
|
#prompt
|
|
|
|
PS1='\u@\h:\w \$ '
|
|
|
|
#renseigne la variable SHELL
|
|
|
|
export SHELL=/opt/bin/bash
|
|
```
|
|
|
|
!!! attention "Il est préférable de se logger une première fois avec en root avec ash et de faire la manip dans une 2nde fenêtre."
|
|
|
|
|
|
|
|
|
|
|
|
[http://tldp.org/LDP/abs/html/index.html](http://tldp.org/LDP/abs/html/index.html)
|
|
|