[GH-ISSUE #961] Plea to Developer: Portable barrier #772

Open
opened 2026-05-05 07:04:55 -06:00 by gitea-mirror · 15 comments
Owner

Originally created by @NikoMuffin on GitHub (Nov 28, 2020).
Original GitHub issue: https://github.com/debauchee/barrier/issues/961

Hello,
I've noticed Barrier stores its settings in multiple folders. This is my #1 request for this beautiful & useful software.

Settings are stored in:
C:\Program Files\Barrier
C:\Users\user\AppData\Local\Barrier
C:\ProgramData\Barrier

Is it possible implement the -portable command argument so that I can run Barrier from another directory and all settings get stored in the program directory? Pretty please?
D:\Applications\Barrier

Originally created by @NikoMuffin on GitHub (Nov 28, 2020). Original GitHub issue: https://github.com/debauchee/barrier/issues/961 Hello, I've noticed Barrier stores its settings in multiple folders. This is my #1 request for this beautiful & useful software. Settings are stored in: C:\Program Files\Barrier C:\Users\user\AppData\Local\Barrier C:\ProgramData\Barrier Is it possible implement the -portable command argument so that I can run Barrier from another directory and all settings get stored in the program directory? **Pretty please?** D:\Applications\Barrier
Author
Owner

@ArmandoRl1 commented on GitHub (Dec 1, 2020):

This would be wonderful to have

<!-- gh-comment-id:736195142 --> @ArmandoRl1 commented on GitHub (Dec 1, 2020): This would be wonderful to have
Author
Owner

@albertony commented on GitHub (Dec 4, 2020):

I agree, an easy to use, official portable mode would be nice! Combined with a zip distribution for copy-deploy.

If you can manage with just the command line editions (barriers.exe and barrierc.exe), I think it is possible already:

  • When running the client and server, specify path to where you want your settings stored with command line argument --profile-dir <path>.
    • In your case --profile-dir D:\Applications\Barrier.
    • For example: D:\Applications\Barrier\barriers.exe --profile-dir D:\Applications\Barrier --no-daemon --no-tray --enable-crypto
    • The default path, when this argument is not specified, will otherwise be %LocalAppdata%\Barrier.
  • On the server, if you name the server configuration file barrier.sgc and put it in the configured --profile-dir, it will be picked up automatically. Alternatively you can set a custom path to configuration file with argument --config.

From what I can see, nothing will be written to outside of the configured profile-dir!

If you want a minimal, copy-install, command-line-only deploy, you only need the following files, which you can copy from an existing installation, or extract from .exe installer using innounp:

barrierc.exe
barriers.exe

Due to dependency to OpenSSL, used for encryption (argument --enable-crypto), you need these files in addition (originally thought these were not needed unless using --enable-crypto, but found out they are a "hard" dependency):

libeay32.dll
ssleay32.dll

Optionally, if you want to be able to generate certificate, you also need these (on the server):

openssl.exe
barrier.conf

You will need the Microsoft Visual C++ Redistributable for Visual Studio 2019 installed, although it is possible to copy-install msvcp140.dll, vcruntime140.dll and vcruntime140_1.dll into the application directory.

If you want to use encryption, you can generate certificate and fingerprint in a SSL directory structure the same way as the GUI application does, like this:

mkdir "D:\Applications\Barrier\SSL\Fingerprints" >NUL 2>&1
set OPENSSL_CONF=D:\Applications\Barrier\barrier.conf
"D:\Applications\Barrier\openssl.exe" req -x509 -nodes -days 365 -subj /CN=Barrier -newkey rsa:2048 -keyout "D:\Applications\Barrier\SSL\Barrier.pem" -out "D:\Applications\Barrier\SSL\Barrier.pem"
"D:\Applications\Barrier\openssl.exe" x509 -fingerprint -sha1 -noout -in "D:\Applications\Barrier\SSL\Barrier.pem" > "D:\Applications\Barrier\SSL\Fingerprints\Local.txt"

Edit: I realize --profile-dir is undocumented. Not listed in --help output, nor mentioned in wiki. That should be a small first step, I think.

<!-- gh-comment-id:739028515 --> @albertony commented on GitHub (Dec 4, 2020): I agree, an easy to use, official portable mode would be nice! Combined with a zip distribution for copy-deploy. If you can manage with just the command line editions (barriers.exe and barrierc.exe), I think it is possible already: - When running the client and server, specify path to where you want your settings stored with command line argument `--profile-dir <path>`. - In your case `--profile-dir D:\Applications\Barrier`. - For example: `D:\Applications\Barrier\barriers.exe --profile-dir D:\Applications\Barrier --no-daemon --no-tray --enable-crypto` - The default path, when this argument is not specified, will otherwise be `%LocalAppdata%\Barrier`. - On the server, if you name the server configuration file `barrier.sgc` and put it in the configured `--profile-dir`, it will be picked up automatically. Alternatively you can set a custom path to configuration file with argument `--config`. From what I can see, nothing will be written to outside of the configured profile-dir! If you want a minimal, copy-install, command-line-only deploy, you only need the following files, which you can copy from an existing installation, or extract from .exe installer using [innounp](http://innounp.sourceforge.net/): ``` barrierc.exe barriers.exe ``` Due to dependency to OpenSSL, used for encryption (argument `--enable-crypto`), you need these files in addition (originally thought these were not needed unless using `--enable-crypto`, but found out they are a "hard" dependency): ``` libeay32.dll ssleay32.dll ``` Optionally, if you want to be able to generate certificate, you also need these (on the server): ``` openssl.exe barrier.conf ``` You will need the [Microsoft Visual C++ Redistributable for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) installed, although it *is* possible to copy-install `msvcp140.dll`, `vcruntime140.dll` and `vcruntime140_1.dll` into the application directory. If you want to use encryption, you can generate certificate and fingerprint in a SSL directory structure the same way as the GUI application does, like this: ``` mkdir "D:\Applications\Barrier\SSL\Fingerprints" >NUL 2>&1 set OPENSSL_CONF=D:\Applications\Barrier\barrier.conf "D:\Applications\Barrier\openssl.exe" req -x509 -nodes -days 365 -subj /CN=Barrier -newkey rsa:2048 -keyout "D:\Applications\Barrier\SSL\Barrier.pem" -out "D:\Applications\Barrier\SSL\Barrier.pem" "D:\Applications\Barrier\openssl.exe" x509 -fingerprint -sha1 -noout -in "D:\Applications\Barrier\SSL\Barrier.pem" > "D:\Applications\Barrier\SSL\Fingerprints\Local.txt" ``` Edit: I realize `--profile-dir` is undocumented. Not listed in `--help` output, nor mentioned in [wiki](https://github.com/debauchee/barrier/wiki/Command-Line). That should be a small first step, I think.
Author
Owner

@NikoMuffin commented on GitHub (Dec 5, 2020):

@albertony thank you! I discovered this just yesterday and appreciate the summary.

I want to ask if the dev can make a "-portable" command argument that would do all this automatically. That would be wonderful.

<!-- gh-comment-id:739131201 --> @NikoMuffin commented on GitHub (Dec 5, 2020): @albertony thank you! I discovered this just yesterday and appreciate the summary. I want to ask if the dev can make a "-portable" command argument that would do all this automatically. That would be wonderful.
Author
Owner

@NikoMuffin commented on GitHub (Dec 5, 2020):

@albertony unfortunately neither command works and it's a triple whammy.

This is what I used:

D:\Applications\Barrier\barrier.exe --profile-dir "D:\Applications\Barrier\settings"

I got a folder created in:
C:\Users\Nightcrawler\AppData\Local\Barrier
C:\Users\Nightcrawler\AppData\Local\Barrier\SSL
C:\Users\Nightcrawler\AppData\Local\Barrier\SSL\Fingerprints

and nothing I do stops Barrier from creating registry entries:
HKEY_CURRENT_USER\Software\Debauchee\Barrier
HKEY_LOCAL_MACHINE\SOFTWARE\Barrier

<!-- gh-comment-id:739138708 --> @NikoMuffin commented on GitHub (Dec 5, 2020): @albertony unfortunately neither command works and it's a triple whammy. This is what I used: D:\Applications\Barrier\barrier.exe --profile-dir "D:\Applications\Barrier\settings\" I got a folder created in: C:\Users\Nightcrawler\AppData\Local\Barrier C:\Users\Nightcrawler\AppData\Local\Barrier\SSL\ C:\Users\Nightcrawler\AppData\Local\Barrier\SSL\Fingerprints and nothing I do stops Barrier from creating registry entries: HKEY_CURRENT_USER\Software\Debauchee\Barrier HKEY_LOCAL_MACHINE\SOFTWARE\Barrier
Author
Owner

@albertony commented on GitHub (Dec 5, 2020):

D:\Applications\Barrier\barrier.exe --profile-dir "D:\Applications\Barrier\settings"

You are probably running the full GUI application? I haven't tried that myself, as I wanted to use it as a portable application from the start. Running the command line applications only, I don't get any of those folders or registry entries. But ok, if so, you have confirmed my suspicion that it does not work with that one.

Then, unfortunately, you will have to use the command line versions: barriers.exe (server) and barrierc.exe (client), and create a text file with configuration for the server as described here https://github.com/debauchee/barrier/wiki/Command-Line#server-configuration-file. If you want to try this and have more questions, just ask.

<!-- gh-comment-id:739150192 --> @albertony commented on GitHub (Dec 5, 2020): > D:\Applications\Barrier\barrier.exe --profile-dir "D:\Applications\Barrier\settings" You are probably running the full GUI application? I haven't tried that myself, as I wanted to use it as a portable application from the start. Running the command line applications only, I don't get any of those folders or registry entries. But ok, if so, you have confirmed my suspicion that it does not work with that one. Then, unfortunately, you will have to use the command line versions: barrier**s**.exe (server) and barrier**c**.exe (client), and create a text file with configuration for the server as described here https://github.com/debauchee/barrier/wiki/Command-Line#server-configuration-file. If you want to try this and have more questions, just ask.
Author
Owner

@setushah1 commented on GitHub (Apr 25, 2022):

I did this so far -

  1. Downloaded BarrierSetup-2.4.0-release

  2. Downloaded innounp

  3. Extracted all files from BarrierSetup-2.4.0-release using innounp

  4. Created a new folder D:\Temp\base and copied barriers.exe, barrierc.exe, ssleay32.dll, libeay32.dll to the base folder (though libeay32.dll was not necessary)

  5. created barrier.sgc in the base folder

  6. Configured barrier.sgc as -
    section: screens
    Thinkpad:
    Dell:
    end
    section: links
    Thinkpad:
    right = Dell
    Dell:
    left = Thinkpad
    end
    section: aliases
    PC13F21F:
    Thinkpad
    DESKTOP-IEBI2GF:
    Dell
    end

  7. Issued this command -
    barriers --profile-dir .\

It creates this error -
[2022-04-25T21:33:21] ERROR: cannot read configuration ".\barrier.sgc": read error: line 12: unknown screen name "PC13F21F"
barriers: no configuration available

Executed hostname on command prompt. It gave the same name - PC13F21F

Tried searching about this error but couldn't find any reference in context for portable/command line execution.

<!-- gh-comment-id:1108763179 --> @setushah1 commented on GitHub (Apr 25, 2022): I did this so far - 1. Downloaded BarrierSetup-2.4.0-release 2. Downloaded innounp 3. Extracted all files from BarrierSetup-2.4.0-release using innounp 4. Created a new folder D:\Temp\base and copied barriers.exe, barrierc.exe, ssleay32.dll, libeay32.dll to the base folder (though libeay32.dll was not necessary) 5. created barrier.sgc in the base folder 6. Configured barrier.sgc as - section: screens Thinkpad: Dell: end section: links Thinkpad: right = Dell Dell: left = Thinkpad end section: aliases PC13F21F: Thinkpad DESKTOP-IEBI2GF: Dell end 8. Issued this command - `barriers --profile-dir .\` It creates this error - [2022-04-25T21:33:21] ERROR: cannot read configuration ".\barrier.sgc": read error: line 12: unknown screen name "PC13F21F" barriers: no configuration available Executed `hostname` on command prompt. It gave the same name - PC13F21F Tried searching about this error but couldn't find any reference in context for portable/command line execution.
Author
Owner

@albertony commented on GitHub (Apr 25, 2022):

If you surround your configuration snippet with three ` (backticks) its easier to read (assuming you have some indentation in it), like this:

section: screens
    Thinkpad:
    Dell:
end
section: links
    Thinkpad:
        right = Dell
    Dell:
        left = Thinkpad
end
section: aliases
    PC13F21F:
        Thinkpad
    DESKTOP-IEBI2GF:
        Dell
end

I'm not very familiar with aliases... maybe you can try without it, use the real names directly?

<!-- gh-comment-id:1108933607 --> @albertony commented on GitHub (Apr 25, 2022): If you surround your configuration snippet with three ` (backticks) its easier to read (assuming you have some indentation in it), like this: ``` section: screens Thinkpad: Dell: end section: links Thinkpad: right = Dell Dell: left = Thinkpad end section: aliases PC13F21F: Thinkpad DESKTOP-IEBI2GF: Dell end ``` I'm not very familiar with aliases... maybe you can try without it, use the real names directly?
Author
Owner

@setushah1 commented on GitHub (Apr 25, 2022):

Yes, the file is indented the way you have done.

As per your suggestion I have removed real names and recreated the file -

section: screens
	PC13F21F:
	DESKTOP-IEBI2GF:
end

section: aliases
end

section: links
	PC13F21F:
		right = DESKTOP-IEBI2GF
	DESKTOP-IEBI2GF:
		left = PC13F21F
end

Then executed it with
barriers --profile-dir .\ --disable-crypto --debug DEBUG2

On client side, I could install with installer. And executed the GUI and configured as Client. On client, when I use the name of the server - PC13F21F, the server doesnt recognize it. But if I use IP - 192.168.1.7 then the connection becomes successful. However, the mouse still doesn't move to the client.

<!-- gh-comment-id:1108956278 --> @setushah1 commented on GitHub (Apr 25, 2022): Yes, the file is indented the way you have done. As per your suggestion I have removed real names and recreated the file - ``` section: screens PC13F21F: DESKTOP-IEBI2GF: end section: aliases end section: links PC13F21F: right = DESKTOP-IEBI2GF DESKTOP-IEBI2GF: left = PC13F21F end ``` Then executed it with `barriers --profile-dir .\ --disable-crypto --debug DEBUG2` On client side, I could install with installer. And executed the GUI and configured as Client. On client, when I use the name of the server - PC13F21F, the server doesnt recognize it. But if I use IP - 192.168.1.7 then the connection becomes successful. However, the mouse still doesn't move to the client.
Author
Owner

@albertony commented on GitHub (Apr 26, 2022):

Try to make the server listen for IPv6 in addition to IPv4 by adding argument --address "::".

If that does not work, I'm not sure what is going on. Maybe try this:

-n, --name <screen-name> use screen-name instead the hostname to identify this screen in the configuration.
<!-- gh-comment-id:1110088102 --> @albertony commented on GitHub (Apr 26, 2022): Try to make the server listen for IPv6 in addition to IPv4 by adding argument `--address "::"`. If that does not work, I'm not sure what is going on. Maybe try this: ``` -n, --name <screen-name> use screen-name instead the hostname to identify this screen in the configuration. ```
Author
Owner

@shinji257 commented on GitHub (Mar 9, 2023):

Similar to above I did the following. I have no admin rights on the target client system.

Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network)
barrierc --disable-crypto --exit-pause 10.0.0.160

--exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe).

<!-- gh-comment-id:1462598980 --> @shinji257 commented on GitHub (Mar 9, 2023): Similar to above I did the following. I have _no_ admin rights on the target client system. Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) `barrierc --disable-crypto --exit-pause 10.0.0.160` --exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe).
Author
Owner

@nigerninja commented on GitHub (Jul 23, 2023):

Similar to above I did the following. I have no admin rights on the target client system.

Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) barrierc --disable-crypto --exit-pause 10.0.0.160

--exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe).

Works like a charm. Thanks.

<!-- gh-comment-id:1646879759 --> @nigerninja commented on GitHub (Jul 23, 2023): > Similar to above I did the following. I have _no_ admin rights on the target client system. > > Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) `barrierc --disable-crypto --exit-pause 10.0.0.160` > > --exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe). Works like a charm. Thanks.
Author
Owner

@pgyogesh commented on GitHub (Nov 4, 2023):

Similar to above I did the following. I have no admin rights on the target client system.
Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network)
barrierc --disable-crypto --exit-pause 10.0.0.160
--exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe).

@shinji257 I tried this but getting below error:
The system cannot execute the specified program

<!-- gh-comment-id:1793401666 --> @pgyogesh commented on GitHub (Nov 4, 2023): > Similar to above I did the following. I have no admin rights on the target client system. > Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) barrierc --disable-crypto --exit-pause 10.0.0.160 > --exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe). @shinji257 I tried this but getting below error: `The system cannot execute the specified program`
Author
Owner

@igalech commented on GitHub (Nov 11, 2023):

Similar to above I did the following. I have no admin rights on the target client system.

Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) barrierc --disable-crypto --exit-pause 10.0.0.160

--exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe).

I've followed this options in a Win11 machine where I don't have admin rights. After copying .pem and .cfg files and recreating the SSL directory barrierc.exe <I.P.ADDR.ESS> does work.
Now I'm facing an odd issue. This runs in a CMD (powershell or cmd) window in win11 in the foreground where you can see all the logging from barrierc. Certain apps that take foreground (e.g. notepad++) automatically disable barrier, while others don't (e.g. FF, Chrome, even notepad.exe, etc.) Not sure why.

@shinji257 can you post instructions for how to run this in a batch file/job and have the client running 'silently' in the background?

<!-- gh-comment-id:1806870966 --> @igalech commented on GitHub (Nov 11, 2023): > Similar to above I did the following. I have _no_ admin rights on the target client system. > > Copied in barrierc.exe, libssleay32.dll, libeay32.dll from another Windows install. Launched it with the following command (I'm not using SSL in my network) `barrierc --disable-crypto --exit-pause 10.0.0.160` > > --exit-pause isn't really needed but I got it in a batch file. Just wanted it pause in case there was an issue. You do not need barrier.exe or barriers.exe if it is just going to be a client. You also do not need any of the QT libraries (they are for barrier.exe). I've followed this options in a Win11 machine where I don't have admin rights. After copying .pem and .cfg files and recreating the SSL directory barrierc.exe <I.P.ADDR.ESS> does work. Now I'm facing an odd issue. This runs in a CMD (powershell or cmd) window in win11 in the foreground where you can see all the logging from barrierc. Certain apps that take foreground (e.g. notepad++) automatically disable barrier, while others don't (e.g. FF, Chrome, even notepad.exe, etc.) Not sure why. @shinji257 can you post instructions for how to run this in a batch file/job and have the client running 'silently' in the background?
Author
Owner

@shinji257 commented on GitHub (Nov 11, 2023):

@pgyogesh
If this is a work machine then your IT is likely implementing a policy to restrict which executables can be run.

@igalech
Sorry. I run it rather verbose so I don't know how I might run it 'silently'.

<!-- gh-comment-id:1806913357 --> @shinji257 commented on GitHub (Nov 11, 2023): @pgyogesh If this is a work machine then your IT is likely implementing a policy to restrict which executables can be run. @igalech Sorry. I run it rather verbose so I don't know how I might run it 'silently'.
Author
Owner

@igalech commented on GitHub (Nov 11, 2023):

@shinji257
Thanks.
By silenced I meant running it via conhost, powershell or similar, but without an actual console in the foregruond (like nohup or &). After some digging I've managed to put together a bat file and run barrierc at startup with your list of files and configuration instructions plus the certificates and it runs almost ok.
I thought that was the issue, but I was wrong. Most of the apps from W11 that runs barrierc are responsive to barriers that runs in a central ubuntu box. However, when some apps start in W11 they leave barrierc unresponsive despite still running fine - I can see barrierc in taskmanager and barriers is not complaining (log says entering screen of W11 box). I've made the process realtime and changed process to run in admin mode to no avail. Examples: Windows task manager, notepad++.

<!-- gh-comment-id:1806945691 --> @igalech commented on GitHub (Nov 11, 2023): @shinji257 Thanks. By silenced I meant running it via conhost, powershell or similar, but without an actual console in the foregruond (like nohup or &). After some digging I've managed to put together a bat file and run barrierc at startup with your list of files and configuration instructions plus the certificates and it runs almost ok. I thought that was the issue, but I was wrong. Most of the apps from W11 that runs barrierc are responsive to barriers that runs in a central ubuntu box. However, when some apps start in W11 they leave barrierc unresponsive despite still running fine - I can see barrierc in taskmanager and barriers is not complaining (log says entering screen of W11 box). I've made the process realtime and changed process to run in admin mode to no avail. Examples: Windows task manager, notepad++.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#772
No description provided.