Announcements

Help Wizard

Step 1

NEXT STEP

Re: Does "Remember Me" save my password? if it saves then how to delete?

Re: Does "Remember Me" save my password? if it saves then how to delete?

Enabling Remember Me option on my Linux desktop application even isn't able to remember any of the the previously logged emails.

 

My family have four accounts and it's very very very annoying to be continously retyping usernames and passwords on our living room PC to change the user to acces the playlists of each own.

 

Reply
2 Replies

(Ignore, it posted it twice for some reason)

It's probably a better idea to have multiple accounts on your OS instead.

 

BUT, there is a way to do it without having to log out and log in to a personal account if you're only using a main account. Start by creating a user for each person that you want to be able to have their own Spotify Login, and the follow the guide I wrote below.

 

(ALSO, it might make more sense to change the name of this topic (if the community allows it) to something more relevant, like: Multiple Spotify Accounts or something like that 🙂 )

 

Running Spotify as another user without Logging Out

 

If you do, you shouldn't actually have to switch over to the new user in order to that user's Spotify account. Instead, you can use the `sudo -u` or `su` commands to start up Spotify with the other user's login.

 

sudo -u brandon spotify
-OR-
su brandon -c spotify

This will start up Spotify for the user `brandon`. Note that this should be a user that already exists on your machine. You'll want to consult your distro for how to create a new user on the machine if it doesn't exist already.

 

Making Things More Usable with .desktop Files

 

It's not entirely intuitive to open up a terminal every time you want to open Spotify, so we can make things a little more intuitive by creating Desktop Files for each user. Personally, I use Arch Linux without a Desktop (using i3), so some distros make things a little easier by having a GUI built in to the DE to make Shortcuts/.desktop Files more easily.

But, for those who don't have that option available, we'll go through the process of doing so.

 

These Before starting, make sure you're logged into the main sure account!

 

Find your spotify.desktop file

 

The most sure-fire way to find your spotify.desktop file in the terminal is by using the find command:

# find / -type f -iname '*spotify*.desktop' 2>/dev/null
/usr/share/applications/spotify.desktop

 

Create a .desktop for each user account

 

We'll want to use this as our starting point, so I'm going to copy mine into my ~/.local/share/applications, which is where most applications store their .desktop files.

We'll want to name it based on the user, so that we can keep track of them more easily

cp /usr/share/applications/spotify.desktop ~/.local/share/applications/spotify-brandon.desktop

Now edit the file. You should see something like:

[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Music Player
Icon=spotify-client
TryExec=spotify
Exec=spotify --uri=%U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

Now we'll edit the TryExec and Exec portions to include our use of `sudo -u` or `su`:

[Desktop Entry]
Type=Application
Name=Spotify (Brandon)
GenericName=Music Player
Icon=spotify-client
TryExec=su brandon -c spotify
Exec=su brandon -c spotify --uri=%U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

Done! But... it might won't work. Why? Because, chances are, the user account `brandon` has a password associated with it. Even if it doesn't, our main user account might not be setup with sudo to allow for us to run things as the `brandon` user account. Continue to the second below if running the Spotify (Brandon) app from your Application Runner doesn't work.

 

Avoiding Typing in Passwords Each Time

 

Unless you're running the `spotify` command from your terminal all the time, the solution above probably won't work. And, even if you are, the user will have to type in their password every time they want to start up Spotify.

NOTE: This section enables the main user account to do and see anything the other user can. That means it can be abused to violate a user's privacy by accessing private files or change a user's password. If the user has sensitive information on their account, it might be good to either:

1. Run Spotify from the terminal by manually running the sudo command (requiring the user to enter their password)
2. Logout of your desktop and log in to that user's account
3. Create an additional user account, like `brandonspotify`, that is used exclusively for running Spotify

You have been warned!

We'll want to edit our sudoers file to make sure that the account we're using has the ability to run commands without using the secondary OS account's password.

You can do this by running the visudo command:

$ visudo

Down at the bottom of the file, you should see a section titled

##
## User privilege specification
##

In here, we'll want to create an entry for each user we've created a .desktop file for:

mainuser ALL=NOPASSWD: /bin/su – brandon
mainuser ALL=NOPASSWD: /bin/su – lucy
mainuser ALL=NOPASSWD: /bin/su – george

Save this file, and try your opening your new `Spotify (Brandon)` app in your app launcher.

 

You're done! Now open `Spotify (Brandon)`

 

Once you open Spotify (Brandon), have Brandon log in with their account. If you have any questions, or it doesn't work, feel free to ask! I'll try and remember to revisit the thread.

 

TL;DR: I don't want to learn anything, just tell me how to do it.

 

Create ~/.local/share/applications/spotify-OTHERUSERNAME.desktop:

 

[Desktop Entry]
Type=Application
Name=Spotify (OTHERUSERNAME)
GenericName=Music Player
Icon=spotify-client
TryExec=su OTHERUSERNAME -c spotify
Exec=su OTHERUSERNAME -c spotify --uri=%U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

 

Update sudoers file

 

$ visudo

Append the following to the bottom of the file:

MAINUSERNAME ALL=NOPASSWD: /bin/su – OTHERUSERNAME

 

Open Spotify (OTHERUSERNAME) and login

 

Now, open `Spotify (OTHERUSERNAME)` and log in with their account.

Suggested posts