Approvals: 0/1
This is an old revision of the document!
Access Batocera Linux via ssh
First, make sure that SSH is enabled on your box — by default, on a fresh install, it is enabled. Check your /userdata/system/batocera.conf
file and make sure you have:
system.ssh.enabled=1
When SSH is enabled, the only Linux user on a Batocera system is root
:
ssh root@batocera.local
- user is always
root
- the default password is
linux
- if you enabled SYSTEM SETTINGS → SECURITY, the root password is visible from this menu.
For passwordless authentication, you can add your public SSH keys (from ~/.ssh/id_rsa.pub
on your client machine) to the list of authorized keys on your Batocera box into the file /userdata/system/.ssh/authorized_keys
.
Windows users are advised to use Putty to connect through ssh: https://www.putty.org
Linux and MacOSX users can use command line ssh
from a terminal.
Basic SSH commands
Once you are connected to batocera, you can use the command-line to operate on the system.
Know that upon connecting, you will be put into the HOME folder of Batocera, this folder is called ~
and is located at /userdata/system
.
Using the command line with paths of files can be confusing at first, there are two types of paths:
- Absolute paths : they will always be the same ones regardless of the current directory you are in, and they start with a
/
character, for exemple/userdata/saves
- Relative paths : they are relative to you current position, for exemple, if you are in the
/userdata
directory, and you usenano system/batocera.conf
, you will execute the command nano on the filebatocera.conf
located in the/userdata/system
folder.
If a path, or a filename, contains special characters or spaces, you will need to put either single quotes '
or double quotes "
around it
Here is a subset of the commands you might want to know:
Basic file usage
cd
: changes the current working directory [Change Directory], for exemplecd /userdata/roms
puts you in the/userdata/roms
folderdu -sh
: gives you the size of the specified element [Disk Usage, Specified, Human-readeable], for exempledu -sh /userdata/roms/snes
gives you the size of the snes roms folder (If you use batocera on a PC, and access it from a windows computer with the file manager, the size of some elements may not be accurate, especially for .wine games, so this command lets you see the actual size)ls
: lists the files and folders present in the current directory [LiSt].mkdir
: creates a directory [MaKe DIRectory], for exemplemkdir content
will create a directory calledcontent
in the current working directory.nano
: opens a command-line text editor for the specified file, for exemplenano /userdata/system/batocera.conf
opens the filebatocera.conf
to edit it, for more infos see this link (external).rmdir
: deletes a directory if it is empty [ReMove DIRectory], for exemplermdir content
will delete the directory content if it is empty.rm
: deletes a specified file [ReMove], for exemplerm invaders-201226-124223.png
will erase the fileinvaders-201226-124223.png
in the current working directory.rm -r
: deletes a directory and all the files it contains [ReMove, Recursive], use with caution!
Debugging
reboot
: reboots the systempidof
: gives a list of PIDs for a running process name, for exemplepidof retroarch
returns a number when a retroarch-based emulator is running.kill
: kills a process with a given PID, for exemple ifpidof retroarch
returned 640, then doingkill 640
will terminate the retroarch process.
Internet functionnalities
batocera-upgrade
: let's you update batocera using the command-line with the correct URL, see Manual upgrades/downgrades for more detailspacman -Ss
: let's you search through the pacman packages using the command-line, see Batocera Package Manager (pacman) for more infos.pacman -S
: let's you install a package using it's name, see Batocera Package Manager (pacman) for more infos.
Logging to a file
Sometimes, you might prefer having the output of a command inside a separated text file instead of reading through the command line interface. to do that you can use the >
and >>
symbols followed by the path of a filename.
for exemple, the command ls
gives you the list of all files and folders in your current working directory, if you want to gather this inside a text file named list-files.txt
at /userdata/system
, you simply need to use:
ls > /userdata/system/list-files.txt
, the command will return nothing, and instead the files will be listed inside a new file called list-files.txt located in /userdata/system. Running the command again will replace the content of list-files.txt.ls >> /userdata/system/list-files.txt
however will add the output of the command to the existing file, without removing the previous infos.
Advice
Whenever you are using a command-line, try to understand what you are doing, even if it doesn't seem like it, some of them can be used in harmful ways. for exemple, putting simply > empty.txt
without any command will create an empty file called empty.txt in the current working directory, however if you already had a useful file with this name, it'll be empty after this command.
- access_the_batocera_via_ssh.1609441399.txt.gz
- Last modified: 3 years ago
- by fishou