Ask Your Question
0

how can i set the sage server password through command line

asked 2015-08-31 04:48:41 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I am writing an ansible playbook to automate installation of sage. The playbook looks like this:

---
- hosts: localhost
  remote_user: root

  tasks:
   - name : update system
     apt : update_cache=yes    

   - name : install m4
     apt : name=m4 state=present

   - name : install build-essential
     apt : name=build-essential state=present 

   - name : install gcc
     apt : name=gcc state=present

   - name : install gfortran
     apt : name=gfortran state=present

   - name : install libssl-dev
     apt : name=libssl-dev state=present

   - name : install python-software-properties
     apt : name=python-software-properties state=present

   - name : add sage ppa repo
     apt_repository: repo='ppa:aims/sagemath'

   - name : update system
     apt : update_cache=yes

   - name : install dvipng
     apt : name=dvipng state=present

   - name : install sage binary
     apt : name=sagemath-upstream-binary state=present

   - name : invoke create_sagenb script
     command: /usr/bin/screen -d -m sudo /root/databases-and-datamining-iiith/python-scripts/create_sagenb -i -y

   - name : invoke start_sage script
     command: /usr/bin/screen -d -m sudo /root/databases-and-datamining-iiith/python-scripts/start_sage -i -y

Clearly, this playbook will not set the password for sage server and hence the sage service will not start. Is there any way to set password from command line or to start sage service without password.

edit retag flag offensive close merge delete

1 answer

Sort by ┬╗ oldest newest most voted
0

answered 2015-08-31 13:53:14 -0600

tmonteil gravatar image

updated 2015-08-31 13:58:19 -0600

It seems indeed that there is no standard way to setup the admin password noninteractively. Here is a possible workaround, that uses the fact that the password is stored in the file ~/.sage/sage_notebook.sagenb/users.pickle/. I attach an example of users.pickle (with the password 123456). The following two lines should solve your problem:

mkdir -p ~/.sage/sage_notebook.sagenb
cp /path/to/users.pickle ~/.sage/sage_notebook.sagenb/

Note: the file has a .png extension so that i can upload it on ask.sagemath.org, it is actually an ASCII file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-08-31 04:48:41 -0600

Seen: 282 times

Last updated: Aug 31 '15