IntelliJ - running as sudo throough JetBrains Toolbox - intellij-idea

I want to start intelliJ from Toolbox and manage it from there but need intelliJ to run as sudo. Does anyne know if it's possible?
Edit:
I need this because on my local machine my application cannot create folders for which normally root is needed - saving logs to specific folder in system.

Compared to run JetBrains App from Toolbox with root, it's easier for you to change that specific folder non-root user writable, with something like
sudo chown <user> <folder>
However, this may cause some security problem if that specific folder is somewhere system wide related, for example inside /usr/bin/, so it's better not to do so. But if you really need that, you may try to gain sudo privilege for example use gksudo while running your application.

Related

Where to store git repo to run swa efficiently using wsl2?

I'm trying to run my static web app using Windows Subsystem for Linux (2), but I can't figure out where on my computer I should store the git repository to be able to run it decently quickly. I have tried storing it on under /mnt/c/{workfolder}, but it takes several minutes to start up (using npm run start), and I have to rerun to see any changes. This is useless when I'm trying to work...
I have also tried to store it in /mnt/wsl/{workfolder}, and in that case it starts up quickly and I can see my changes without rerunning the app. However, it seems to disappears when I restart my computer.
Where should I store the git repository to be able to run the app quickly and see changes without rerunning? I'm assuming there's something I'm not understanding, help me get this it you know.
You'll want it somewhere on the ext4 partition of the WSL distribution. Typically, the best place is going to be under your WSL /home/<username> folder.
I would recommend:
mkdir ~/src
# or
mkdir ~/projects
# or something similar
Then create subdirectories for each project in that directory.
Why the others don't work:
/mnt/c is the Windows C: drive. That drive is mounted into WSL2 using the 9P network file system, and yes, it's (a) slow, and (b) does not support inotify, so apps cannot register for notifications of changes to files.
/mnt/wsl is a tmpfs mount. It's really there for holding things that need to be shared between all running WSL instances. The auto-generated resolv.conf that you see there is one of those things. You can also use it for copying a file from one WSL distribution to another -- Simply copy the file to /mnt/wsl, start another WSL distribution, and copy or move the file out.
But yes, all tmpfs mounts are ephemeral and will terminate when the last WSL2 distribution/instance terminates.

Is it possible to auto allow usage of the microphone in chromium

I man using chromium-browser on raspbian. I was wondering if there was an easy way to auto allow the usage of the microphone. To stop the pop-up blocking one can use the switch --disable-popup-blocking. Sadly I haven't found a switch on here. This list may be incomplete, so maybe I'm missing the switch I need.
To give more context: my home directory is on tmpfs. This means my preferences file is gone after every reboot. But it should be possible to just copy an old Preferences file into the ~/.config/chromium/Default/ directory right? I tried this already, then started the chromium-browser, but when accessing the site I was asked again if I would allow access to the microphone. It seems like the Preferences file just get overwritten on startup, it doesn't matter that it already exists.
I also tried starting chromium-browser so that it creates all the files including the Preferences file and replacing the media_stream_mic entry. But my guess would be that the preferences only get loaded on start so this does nothing.
So am I doing anything wrong? Or is there an easier way to do what I want?
It seems like the problem was the missing ~/.config/chromium/First Run file. If it doesn't exist the chromium-browser will create all the files anew, including the Preferences file which then gets overwritten. If it does exist only the missing files will be created. So copying a version of your Preferences File into ~/.config/chromium/Default/Preferences and creating a the ~/.config/chromium/First Run file will make this possible.
The bash script to do this automatically could look something like this:
mkdir /home/user/.config/chromium
mkdir /home/user/.config/chromium/Default
cp /somewhere/myOldPrefs /home/user/.config/chromium/Default/Preferences
touch /home/user/.config/chromium/First\ Run
chown -R user:user /home/user/.config/chromium
To insert more mic allowed pages one could use a simple sed command, it could look something like this:
sed -i 's/"media_stream_mic":{}/"media_stream_mic":{"https:\/\/\some\.page\.com:443,\*": {"expiration": "0","last_modified": "13271235276310223","model": 0,"setting": 1}}/' /path/to/the/Preferences
# this adds only one page when there are no pages yet

Run intellij application with sudo privileges

I have a scala application that needs to perform sys.process operations with sudo and these operations are failing for me. From my google searching, it appears that I may be able to resolve this by running intellij with sudo. However, when I do this, I'm prompted to import settings and need would need to re-import my project. This seems less than ideal. Is there a way to set up a run configuration in intellij to have sudo privileges or at least run idea.sh with sudo but use my original workspace, so that all changes and configurations are shared between the sudo and non-sudo profiles?
Presumably this is down to Intellij reading its settings from a directory under the current user directory, eg C:\Users\matt.IntelliJIdea13 on my Windows PC. When you sudo, it will try and read its setting from a different directory.
I would check with directory it is trying to save its config to when you run it with sudo. Then set up a soft link from this directory back to your normal user directory. IntelliJ should then read the same set of files whether or not you are using sudo.
eg ln -s /home/matt/.IntellijIdea13 /home/root/.IntelliJIdea13
I haven't got IntelliJ installed on Linux so can't check this.

Redcar Install Direct Options

Is there a way to direct the install of redcar to a user defined location other than a user home directory?
I have a jruby install on a USB drive, E:\jruby-1.6.2. Redcar installs the gems to the E:\jruby sub directory but then installs the user files to ~/ on c:.
Is there a way to direct it to e:\fakehome. I want to keep all installation files on my USB drive.
I do not have a Redcar-specific solution, but here is a general solution that may work for you.
PROBLEM:
The user has an application that installs application data files to a fixed location, but the user wants the files in a different location (such as a removable drive or a standardized app data directory).
SOLUTION:
Use a Junction Point or Symlink to simulate the presence of the pre-configured directory.
STEPS:
install the application normally
locate the pre-configured directory that you wish to have relocated (e.g. c:\users\foouser\appdata\fooapp)
create an empty directory with the same name in your alternate desired location (e.g., e:\myusbdrive\appdata\fooapp)
terminate the application you just installed if it is still running
move all of the files out of the pre-configured directory and put them in the desired directory
delete the toplevel pre-configured directory
create a junction that points to the toplevel pre-configured directory you just deleted from the alternate desired location
restart the application and use it normally, making sure that it still behaves normally.
If all goes well you should be finished.
Here i a link to a junction creator (for older versions of Windows (TM))
http://technet.microsoft.com/en-us/sysinternals/bb896768
HTH
This response from Matthew Scharley directly answers how this can be done for redcar.
For the moment it is hard coded. Thankfully it is easy to change:
https://github.com/redcar/redcar/blob/master/lib/redcar.rb#L211

Why does the building from Binary files do not require Root access?

When I am in my dept's server, I cannot use commands such as "apt-get install nethack". I have to build the nethack from Binary files to get it working, at least so I have been told. I cannot understand the reason. Why do I need to build things from binaries? Why is the use of the commands, such as "apt-get", forbidden? Why do I not need Root access to build from binaries?
apt-get is a system-level command that installs packages for all users.
If you download and compile, you are only creating local "copies" of the binaries, not system-wide. If you tried to complete the install process with make install this would most likely fail because you do not have sufficient privileges to install the program for all users' access (same reason you can't run apt-get install)
When you compile a program from source, you can give it the '--prefix=~/'. This causes it to install relative to your own home directory (so binary programs typically end up in '~/bin', man pages in '~/man' etc). This poses no problems because you already have permission to write here.
Apt-get on the other hand installs the packages in the global filesystem ('/bin/', '/usr/bin/', etc), which can impact other users and so, quite rightly, require administrative access.
If you want to install some program you can use the command
apt-get source app-name
This will work even if you are not root since it only fetch the source code to the app-name and put it in the current directory, which is easier than having to track down the source and there is a better chance to get it work, since you download the version that should work on your system.
Alternatively you should bug your sysadmin to install the programs you need, since it is his job (and if you need them, chances are that the rest of your team does too).
Because apt-get will install a program system wide.
The locations to which apt-get writes installed files (/bin, /usr/bin, ...) are restricted to root access. I imagine that when you build from source you're not executing the install step of the bulid. You're going to need to set a prefix for the installation such that the packages end up somewhere you can write. This thread talks a bit about setting prefixes for apt-get and you'll probably want to set your prefix to something like
~/software/
and then add the resulting bin directories to your PATH.