Download code from GCloud VM instance with expired RStudio Server license - r

I had created a Google compute engine (virtual machine) instance with RStudio Server being unaware that RStudio Server is a licensed software. Now, my trial license for RStudio has expired, and I cannot login to my R sessions anymore.
However, I had written some code which I need to recover. How do I download the files?
I have SSH-ed into my virtual machine but cannot find the relevant files or a way to download them.

I had a similar issue and I was able to recover the files by performing the following steps:
SSH to the virtual machine
Once you are in the virtual machine run the following command: cd ../rstudio-user/
Now ls there you will see the file structure you used to see in the RStudio Server interface}
Navigate using cd and ls between the folders to get to the desired file
Once you are in the desired location (where with an ls you can see the files you want to recover) run the following command: pwd
Click on the Engine and go to download file
Enter the full path of the file you want to download, it will be something like: /home/rstudio-user/FILENAME.R
Click on Download
You can do this for each of the files you want to recover.
In case you want to recover a full folder its easier to compress to a zip file and then to download it.

Related

Is it possible to install Rstudio server on Linux without root access?

I'm an undergraduate research assistant working on a Linux server without root privilege. I'm trying to install the Rstudio server but the Rstudio website only provides the installation method for sudoers. Is it possible to install it without root access? I'm asking because I'm really not sure if I could get access from the manager. Any help will be appreciated!
No, you can't install it without root access. But there are a couple of things you could do to piece together a solution. Here are two options:
Extract the server and run it directly
You have to be root to install packages, so you can't install the .deb/.rpm file yourself. However, you could extract the contents of the file to a directory inside your home directory and run RStudio Server from there, by executing the rserver program in a regular shell.
Note that this will probably require an afternoon of editing the rserver.conf file to tell it where to find the rest of the files in the installation (since it presumes they are installed in /usr/lib by default). You can get some inspiration for how to do this here: https://github.com/rstudio/rstudio/blob/master/src/cpp/conf/rserver-dev.conf
Run the desktop version and forward the graphics
The other route is to run RStudio Desktop on the server; we make several builds of RStudio Desktop that are installer-less and can just be unpacked into your home directory. Then run an X11 server on your own computer and an X11 client on the RStudio server, so that the RStudio Desktop instance appears on your computer instead of the server.
Yes, you can run rserver without root priveliges.
For RStudio 1.4 I patched the following line into src/cpp/core/LogOptions.cpp
const FilePath kDefaultLogPath = core::system::xdg::userDataDir().completePath("log");
Then you need to set the system environment variables to some location read-writeable for the user, like
RSTUDIO_CONFIG_DIR=$HOME/.config/rstudio
RSTUDIO_CONFIG_HOME=$HOME/.config/rstudio
RSTUDIO_DATA_HOME=$HOME/.local/share/rstudio
And start rserver with the option
--server-data-dir={directory writeable for user}
--server-pid-file={file-path creatable for user}
--database-config-file={config-file}
With these adjustments it runs for me when I start it as a simple user (no root privileges) with
rserver --auth-none=1 --www-frame-origin=same --www-port={port} --www-verify-user-agent=0 --server-data-dir={my-tmp-path} --server-pid-file={my-tmp-path}/rstudio.pid --database-config-file={my-tmp-path}/db.conf}
ATTENTION:
But be aware, that anyone who can reach your system and the specified port from the network has access to the running RStudio in his browser and therefore can run any command in the name of the user on your system now.

Artifactory backup directory is not recognized

I wanted to change the backup to a different disk. I mounted the disk to /mnt2 on centos and when I navigate to Admin > Backups > Backup Daily > Edit backup-daily Backup, I see an option Server Path For Backup. I tried the following two things.
I entered the mount directory /mnt2 and hit run now. The background job fails with the following error in logs.
An error occurred while performing a backup: Backup directory provided
in configuration: '/mnt2' cannot be created or is not a directory.
I also tried creating a tmp2 directory on local drive and entered /tmp2 and hit run now. The background job fails with the same error as above.
Note 1:
I restarted the docker container just to see if it's not picking up file system changes in real time. That did not work.
Note 2:
There is a browse button next to Sever Path for Backup and I dont see /mnt2 or /tmp2 directories I created. I couldnot find anything useful in the documentation either.
How do I change the backup directory for artifactory?
The setup is artifactory with docker.
For artifactory docker instance, a volume needs to be specified so it maps to the local folder, say, /opt/artifactory/.
In my case, /var/opt/jfrog/artifactory(docker) is mapped to /opt/artifactory(local)
I am supposed to create a folder here -- /opt/artifactory/backup_mount. Give read and write access for 1039 user and group. It shows up in artifactory UI as /var/opt/jfrog/artifactory/backup_mount.
Note:
If you create a directory, it shows up without any docker restart.
If you create a mount, restart docker so the mount is recognized.

RStudio gives "Incorrect function" when setting git as Version control

When I create a new project and select to create a new Git repository, or when I try to change the version control system in project options I receive a RStudio error stating "Incorrect function" with a big X and no extra information.
The below link has a similar issue, but their solution of changing the path for git.exe has not helped (i have tried all three paths)
https://support.rstudio.com/hc/en-us/community/posts/200632528-Git-Error-Incorrect-Function
Some extra notes:
RStudio allows me to clone repository to set new working directory
Also git works in bash, so i feel this is an RStudio issue.
I encountered the same error. For me it also had to do with using a network path not a local directory for the project location (as for lewis1211).
Workaround: Map the network drive. E.g. Map your //server/share to some drive, say Z: (using map network drive, if you are using windows). If you set your project up under Z: then, it works.
If you have already chosen "git.exe" in RStudio --> Tools --> Global Options --> Git/SVN, then try to open Rstudio shell and type git init. In my case it showed "Permission denied", and after running as administrator the problem has gone.
This is only a partial answer if it fixes your problem: I reproduced this when trying to use a network path for a project location. When using a local directory no error occurs. Could indeed be an RStudio issue.
Run you R studio as Project administration.
This solves my issue.
SOLVED.
I had the same problem. The Git-RStudio-Connection fails but git is working perfectly in the CMD. When running the git init command in CMD it works and creates a .git folder. But running the git init command in the RStudio terminal fails with a message Warning: unable to access 'C:/Users/%username%/.gitconfig': Permission denied ... fatal: unknown error occured while reading the configuration files.
The Version Control Sytem (VCS) or git-Panel does not appear in RStudio and selecting it in the projects options leads to the same message Error: Unzulässige Function (eng. Error: Incorrect function).
A closer look into the .gitconfig file should give you a new solution approach hopefully without having administration rights. Comparing the installation on the integration worksation with a productive workstation shows, that on the Test-Machine an incomplete .gitconfig file is on C:/Users/%username%/.gitconfig and on the Productive-Machine a complete gitconfig file is on Z:/.gitconfig. By the way, Z is a mapped drive which is linking to the company's user-profile settings (see CMD > echo %HOMEDRIVE%).
According to this analysis there should be multiple possible solution approaches:
(1) delete the corrupt .gitconfig and hope the the system is correctly looking into your profiles directory
(2) complete the .gitconfig file that all necessary information are there. The message fatal: unknown error occured while reading the configuration files could actually be a hint, that the first message access... permission denied is false and the problem lies in the incomplete file.
(3) Be aware that there can be a confusion between ".gitconfig" as FILE and ".gitconfig" as FOLDER. Check this with changing directory with cd to folder and cat to show the file content. It will tell you that you cannot display a folder as file-content.
(4) Change the location of the config file with git config --file FullnameToGitconfig. e.g. git config --file %USERPROFILE%/.gitconfig or git config --file %USERPROFILE%/.gitconfig/gitconfig or git config --file %HOMEDRIVE%/.gitconfig etc.
[user]
name = DOE John
email = john.doe#acme.com
[merge]
tool = kdiff3
[mergetool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
[diff]
guitool = kdiff3
[difftool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
[core]
editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor

Where is the Rserve Config file located on Windows?

I'm using a Windows 7 x64 machine with R-3.1.0. I installed the Rserve package through Rstudio.
The start of Rserve is successful with the following code in Rstudio:
library(Rserve)
Rserve()
I got the following output:
Starting Rserve...
"C:\R\R-31~1.0\library\Rserve\libs\x64\Rserve.exe"
My problem is that I couldn't locate the configuration file. Apparently it can't be "/etc/Rserv.conf".
I did come across a webpage saying that the config file is Rserv.cfg in the working directory (unless changed at compile-time). But which working directory? I have checked the working directory of the current R project as well as the Rserve library directory, but it was not there...Could someone help me with this please? Thank you.
Rserve does not automatically come with a config file, you must make one. Best steps for doing so:
Navigate to the file where you just installed Rserve.exe (C:\R\R-31~1.0\library\Rserve\libs\x64\R, based on the message you copied here)
Find Rserve.exe, Reserve_d.exe, and Rserve.dll there. Copy these files.
Navigate to where R.dll is on your computer. This is probably C:\Program Files\R\R-3.1.3\bin\x64, but may be different depending on where you installed R to.
Copy the 3 files mentioned above to this location.
Create a text file here named "Rserv.cfg" with the arguments you are looking for, such as port 6312 or library(mvoutlier). Yes, I know that this is different from the documentation, but if you start Rserve_d.exe you will see that this is the file it is looking for. I have not had success naming it anything else.
You can start Rserve by specifying the location of the config file. In R instead of just Rserve() try the following:
Rserve(args="--RS-conf C:\\folder\\Rserv.cfg")
If path is more complicated you need to massage it a little bit:
Rserve(args="--RS-conf C:\\PROGRA~1\\R\\R-215~1.2\\library\\Rserve\\Rserv.cfg")
Look in the $RHOME/bin directory
If you can't find it here is a different way to approach it:
Download Rserve at [http://rforge.net/snapshot/Rserve_.tar.gz], and save it in your desired directory
Run R CMD INSTALL Rserve_.tar.gz
This allows you to leave Rserve where you want it.
After looking at the Rserve source code and making some test I found that on Windows platform Rserve try to load the configuration file from the current working directory. Also pay attention because on Windows the file name is RServ.cfg and not Rserv.conf as documented.
The current working directory depends of the process, for example using RStudio by default it is your Documents and Settings folder:
C:\Users\[username]\Documents
but can be changed in the "Global Options" of the IDE
So you can create an "RServ.cfg" text file in that directory with your needed options and starting RServe in the usual way in RStudio
Rserve()
will load your configuration.

User in Unix not able to run hadoop command

I installed Hadoop and Created a user named hduser and changes owner of hadoop folder to hduser.
After installing Hadoop i try to execute the hadoop command to check whether it is installed or not but it is giving "hadoop" command not found.
Then i had given execute privilege to hduser on all the files inside hadoop folder include bin folder
But still output is same.
When i am trying the same hadoop command with root as a user its working fine.
I think it is related to unix commands. Please help me out to give my user the privilege to execute hadoop command.
One more thing if i switch to root then hadoop commands works fine.
It is not a problem of privileges. You can still execute hadoop, if you type /usr/local/hadoop/bin/hadoop, right?
The problem is that $PATH is user-specific.
You have to add your $HADOOP_HOME/bin to the $PATH, as hduser, not as root. Login as hduser first (or just type su hduser) and then export PATH=$PATH:/$HADOOP_HOME/bin, as #iamkristian suggests, where $HADOOP_HOME is the directory in which you have placed hadoop (usually /usr/local/hadoop).
I sounds like hadoop isn't in your path. You can test that with
which hadoop
If that gives you command not found the you probably just need to add it to your path. Depending on where you installed hadoop, you need to add this to your ~/.bashrc
export PATH=$PATH:/usr/local/hadoop/bin/
And then reopen your terminal

Resources