How does a tenure track professor get money to recruit PhD students? Does the university/institution or department give money to their tenured-track professors to hire PhD-students?
Do they have to write grants to get funded to recruit PhD students?
What are the possible ways a tenured-track professor can hire PhD students?
Edit:

I am thinking of European countries (France &amp; Germany in particular).
My field is computer science.
You name two of the ways that funds for this might be available. Including support for doctoral students in grants is common. If you want departmental or university funds, however, it is best to negotiate that as part of a &quot;start up package&quot; that some universities are able to provide.
But, most universities will normally make at least some minimal efforts to recruit graduate students and most will also provide funds for teaching and, perhaps, research assistants generally, so the funding may not be through the professor at all, but through the department. These funds generally require the student to perform some duties in return for the stipend.