I have a remote backup setup. This uses a dedicated ssh user. Let's call the user rsyncbak-ubuntu-vm

I started testing this on Ubuntu. Inside the home directory of rsyncbak-ubuntu-vm, Ubuntu creates a snap/ directory.

When does Ubuntu create the snap/ directory? Is it when the user is created? Is it when a PAM session is first opened for the login, e.g. because an ssh connection was opened?

1 Answer 1


The snap directory was created when a systemd user instance was started for the login. This happened because a PAM session was opened. In my case, the PAM session was opened for an ssh connection.

# cd ~rsyncbak-ubuntu2204-vm
# ls -l snap/
total 4
drwxr-xr-x 4 rsyncbak-ubuntu2204-vm rsyncbak-ubuntu2204-vm 4096 May 26 15:35 snapd-desktop-integration

$ cd /etc/systemd/user
$ ls -l default.target.wants/*snap*
lrwxrwxrwx 1 root root 82 May 13 13:10 default.target.wants/snap.snapd-desktop-integration.snapd-desktop-integration.service -> /etc/systemd/user/snap.snapd-desktop-integration.snapd-desktop-integration.service

$ cd /etc/pam.d
$ grep systemd *
common-session:session  optional    pam_systemd.so 
runuser-l:-session  optional    pam_systemd.so
$ ls *ssh*
$ grep common-session sshd
@include common-session

Qualifier: this only applies to PAM sessions which Ubuntu label as "interactive". The PAM config file common-session-noninteractive does not launch a systemd user instance.

$ grep "include common-session-noninteractive" *
atd:@include common-session-noninteractive
cron:@include common-session-noninteractive 
polkit-1:@include common-session-noninteractive
sudo:@include common-session-noninteractive
  • Next logical question is how to suppress this behaviour.
    – MKesper
    Commented May 27 at 11:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .