Issue
username@mylaptop:~$ curl https://cdn.liferay.cloud/lcp/stable/latest/install.sh -fsSL | bash
...
...
...
Installed, type 'lcp --help' to start.
username@mylaptop:~$ lcp --help
username@mylaptop:~$
- If
lcp command is run using sudo command, it is unable to open web browser for authentication:
username@mylaptop:~/$ sudo lcp login -v
Remote infrastructure: liferay.cloud
Should get new token: false
Fetching current user...
Could not retrieve current user.
Reason: Request failed with status code 404
? Open your browser and authenticate? Yes
Environment
- Linux Debian Operating System.
Resolution
- For opening the web browser,
lcp calls xdg-open command. And this command, in turn, conflicts with sudo command. This is what happens under the hood:
username@mylaptop:~/$ sudo xdg-open https://console.liferay.cloud/login-sso
Running Firefox as root in a regular user's session is not supported ($XAUTHORITY is /run/user/1000/.mutter-Xwaylandauth.ESSMP1 which is owned by username.)
username@mylaptop:~/$
- To fix the issue, the
lcp binary file must have setuid root changed:
username@mylaptop:~$ ls -l lcp
-rwsr-xr-x 1 root staff 68136679 jun 3 11:16 lcp
username@mylaptop:~$
- Thus, it is no longer necessary to use
sudo command, so you can invoke lcp command directly:
username@mylaptop:~/$ lcp login -v
Remote infrastructure: liferay.cloud
Should get new token: false
Fetching current user...
Could not retrieve current user.
Reason: Request failed with status code 404
? Open your browser and authenticate? Yes
Opening server with the following URL: https://console.liferay.cloud/login?redirect_uri=http%3A%2F%2Flocalhost%3A40169%3Fversion%3D3
✓ Authentication completed [2/2]
...
...
...